定制 descom/omnipay-paypal 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

descom/omnipay-paypal

Composer 安装命令:

composer require descom/omnipay-paypal

包简介

PayPal Orders v2 (REST) driver for Omnipay

README 文档

README

PayPal Orders v2 (REST) driver for Omnipay.

Tests Analyse Style fix

Implements the current PayPal Orders v2 API (/v2/checkout/orders) with the redirect approval flow: create an order, redirect the buyer to PayPal, capture on return.

Instalation

composer require descom/omnipay-paypal

Basic Usage

Create purchase request

use Omnipay\Omnipay;

$gateway = Omnipay::create('PayPal');

$gateway->initialize([
    'clientId' => 'YOUR_CLIENT_ID',
    'secret'   => 'YOUR_SECRET',
    'testMode' => true, // sandbox
    'currency' => 'EUR',
]);

$response = $gateway->purchase([
    'amount'         => '12.00',
    'currency'       => 'EUR',
    'transactionId'  => 'ORDER-42',
    'description'    => 'My order',
    'returnUrl'      => 'https://shop.test/paypal/return',
    'cancelUrl'      => 'https://shop.test/paypal/cancel',
])->send();

// Redirect the buyer (GET) to the PayPal approval page.
$response->redirect();

Complete purchase request

On buyer return PayPal appends ?token={orderId} to your returnUrl. Capture the order:

$response = $gateway->completePurchase([
    'token' => $_GET['token'],
])->send();

if ($response->isSuccessful()) {
    // $response->getTransactionReference() -> capture id
}

Framework integration

This is a framework-agnostic Omnipay driver: it has no Laravel dependency and ships no routes or service providers. The buyer-return endpoint (the URL you set as returnUrl) is the host application's responsibility — it should call completePurchase() to capture the order and then redirect the buyer back to the storefront.

On the descom platform this return route is provided generically by descom/payment-gateway, so no PayPal-specific glue is required here.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固