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.
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
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-09