szwtdl / paypal
paypal
v1.0.0
2022-08-30 09:11 UTC
Requires
- ext-json: *
- guzzlehttp/guzzle: 7.4.*
Requires (Dev)
- mockery/mockery: ^1.0
- phpunit/php-invoker: ^2.0.0
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-04-29 05:06:00 UTC
README
Installation
You can add this library as a local, per-project dependency to your project using Composer:
composer require szwtdl/paypal
paypal
use Szwtdl\Paypal\Paypal $paypal = new Paypal('client_id','client_key','dev')
laravel
在刚刚创建的应用里,我们需要更新一下配置文件 config/services.php
,添加以下部分:
config/services.php
'paypal' => [ 'client_id' => '', 'client_key' => '', 'mode' => 'prod', ]
ProductCreate
$paypal->ProductCreate("每天订购", "每天sand", 'SERVICE', 'SOFTWARE', 'https://example.com/streaming.jpg', 'https://example.com/home');
ProductList
$paypal->ProductList(1,20)
ProductDetail
$paypal->ProductDetail("PROD-8RU94658131561729")
ProductUpdate
$paypal->ProductUpdate("PROD-8RU94658131561729", [ 'description' => 'xxx' ]);
PlansList
$paypal->PlansList('PROD-8RU94658131561729', 1, 10, true);
PlansCreate
$paypal->PlansCreate([ 'product_id' => 'PROD-8RU94658131561729', 'name' => '优酷年会员', 'description' => '定期续费', 'status' => 'ACTIVE', 'billing_cycles' => [ [ 'frequency' => [ 'interval_unit' => 'MONTH', 'interval_count' => 3 ], 'tenure_type' => 'REGULAR', 'sequence' => 1, 'total_cycles' => 0, 'pricing_scheme' => [ 'fixed_price' => [ 'value' => 20.99, 'currency_code' => 'USD' ] ] ] ], 'payment_preferences' => [ 'auto_bill_outstanding' => true, 'setup_fee' => [ 'value' => 0, 'currency_code' => 'USD' ], 'setup_fee_failure_action' => 'CONTINUE', 'payment_failure_threshold' => 3 ], 'taxes' => [ 'percentage' => 0, 'inclusive' => false ] ]);
PlansUpdate
$paypal->PlansUpdate("P-0BL89979RT255525KMLQP5AA", [ 'description' => '新产品' ]);