ewertondaniel/standard-paypal-php-sdk
Composer 安装命令:
composer require ewertondaniel/standard-paypal-php-sdk
包简介
PayPal Standard PHP SDK
关键字:
README 文档
README
PayPal Standard PHP SDK
This library provides developers with a simple set of bindings to help you integrate PayPal Standard to a website and start receiving payments.
🛠 Requirements
php >= 8.1
guzzlehttp/guzzle >= 7.0.1
echosistema/simple-http-request" >= 1.0.1
📢 Coming soon package to PHP versions < 8.1.
💻 Installation
First time using PayPal? Create your PayPal account in PayPal, if you don’t have one already.
Download Composer if not already installed
On your project directory run on the command line "composer require ewertondaniel/paypal-standard-php-sdk"
for PHP 8.1;
That's it! PayPal Standard PHP SDK has been successfully installed!
🧑💻 Examples
🔓 Getting authorization
use EwertonDaniel\PayPal\Auth; $authentication = new Auth($client_id, $client_secret, $is_production); $authentication->getScopes(); $authentication->getAccessToken(); $authentication->getTokenType(); $authentication->getAppId(); $authentication->getExpiresIn(); $authentication->getNonce();
💲 Create an Order
use EwertonDaniel\PayPal\Order; $order = new Order($authentication); //Set Purchase Unit $order->setPaypalRequestId() ->setIntent('CAPTURE') ->purchaseUnit() ->setCurrencyCode('BRL') ->addItemWithBasicData('Blacksaber Mandalore', 1, 29900) // string $name, int $quantity, int $value ->setReferenceId() ->setDescription('I can write up to one hundred and twenty seven characters as a description...'); // Set Payment Source $order->pushPurchaseUnit() ->paymentSource() ->paypal() ->experienceContext() ->setPaymentMethodPreference('IMMEDIATE_PAYMENT_REQUIRED') ->setBrandName('Bounty Hunters Guild (BHG)') // Company name ->setLocale('pt-BR') ->setLandingPage('LOGIN') ->setShippingPreference('NO_SHIPPING') ->setUserAction('PAY_NOW') ->setReturnUrl('https://example.com/returnUrl') ->setNotificationUrl('https://example.com/notifyUrl') ->setCancelUrl('https://example.com/cancelUrl'); $response = $order->create();
ℹ Order Details
use EwertonDaniel\PayPal\Order; $order_id = $_POST['token']; $detail = $order->setOrderId($order_id)->detail();
📖 Documentation
🔗 Visit the PayPal for further information regarding:
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-07