我知道有一些关于 PayPal 集成的问题,但我正在尝试使用智能按钮和 REST API 实施 PayPal 快速结账,但没有成功。
我想做的是:
创建付款授权(使用payid和orderid)
将此发送payid给客户端(javascript)以进行批准。
付款后重定向到确认页面。
我已经使用以下代码创建了付款授权:
<?php
// 1. Autoload the SDK Package. This will include all the files and classes to your autoloader
// Used for composer based installation
require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// Use below for direct download installation
// require __DIR__ . '/PayPal-PHP-SDK/autoload.php';
// After Step 1
$apiContext = new \PayPal\Rest\ApiContext(
new \PayPal\Auth\OAuthTokenCredential(
'client id', // ClientID
'cliente secret' // ClientSecret
)
);
// …Run Code Online (Sandbox Code Playgroud)