如何解决如何验证贝宝订阅
我正在尝试验证订阅并将信息保存到数据库中,在我的最后一个问题中,我设置了一个允许双重结帐的结帐,用于订单和订阅。我在这里验证订单:
<?PHP
namespace Sample;
require __DIR__ . '/vendor/autoload.PHP';
use Sample\PayPalClient;
use PayPalCheckoutSdk\Orders\OrdersGetRequest;
require 'paypal-client.PHP';
$orderID = $_GET['orderID'];
class Getorder
{
public static function getorder($orderId)
{
// 3. Call PayPal to get the transaction details
$client = PayPalClient::client();
$response = $client->execute(new OrdersGetRequest($orderId));
$orderID = $response->result->id;
$email = $response->result->payer->email_address;
$name = $response->result->purchase_units[0]->shipping->name->full_name;
$payerid = $response->result->payer->payer_id;
$id = $_GET["UserID"];
include "include/connect.PHP";
//echo "#################### $orderID ###### $email ######### $name ######### $payerid";
$stmt = $conn->prepare("UPDATE User SET Active='2',OrderID='$orderID',PPemail='$email',PPname='$name',PPID='$payerid' WHERE ID = $id");
$stmt->execute();
if(!$stmt){
echo "error" . MysqLi_error($con);
}else{
header("Location:success.PHP?id=$id");
}
?>
<pre>
<?PHP
//echo json_encode($response->result,JSON_PRETTY_PRINT);
?>
</pre>
<?PHP
}
}
/**
*This driver function invokes the getorder function to retrieve
*sample order details.
*
*To get the correct order ID,this sample uses createOrder to create an order
*and then uses the newly-created order ID with Getorder.
*/
if (!count(debug_backtrace()))
{
Getorder::getorder($orderID,true);
}
?>
但我还需要获取订阅详细信息以保存它,我找不到关于订阅的任何好的教程。
解决方法
使用the current Subscriptions API,或注册Subscriptions webhook events。
这些东西都没有受支持的服务器 SDK;使用 direct HTTPS integration,或者根据需要调整 Checkout SDK 的源以执行这些其他调用。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。