php - Payee Poprety PayPal Checkout V2 的问题
问题描述
我希望你在这场全球大流行中一切都好
我在使用 api 进行生产时遇到问题,它不想考虑付费属性,而在 Sandbox 中它可以工作,有人可以帮助我吗?
public static function PaymentGenerator(Int $fact, String $userToken, String $productToken, Float $productPrice, String $productSeller, String $currency, String $short_description){
$config = require('src/Resources/PayPal.php');
$environment = new ProductionEnvironment($config['id'],$config['secret']);
$client = new PayPalHttpClient($environment);
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = [
"intent" => "CAPTURE",
"purchase_units" => [[
"payee" => [
"email" => "steellgold0@gmail.com"
],
"reference_id" => "IMS-" . $fact,
"amount" => [
"value" => $productPrice,
"currency_code" => "EUR"
],
"description" => $short_description
]],
"application_context" => [
"cancel_url" => "http://ismyshop.xyz/payment.php",
"return_url" => "https://ismyshop.xyz/cap.php"
]
];
try {
$response = $client->execute($request);
$query = App::getPDO()->prepare("INSERT INTO payments(`user`,`product`,`order_id`, `sandbox`, `completed`) VALUES (?,?,?,?,?)");
$query->execute(array(
$userToken, $productToken, $fact, 0, 0
));
foreach($response->result->links as $link) {
echo "\t{$link->rel}: <a href='{$link->href}'>{$link->href}</a>\tCall Type: {$link->method}<br>";
}
echo "<a href='https://www.paypal.com/checkoutnow?token='". $response->result->id . "'>https://www.paypal.com/checkoutnow?token=" . $response->result->id . "</a>";
}catch (HttpException $ex) {
echo $ex->statusCode;
print_r($ex->getMessage());
}
}
解决方案
推荐阅读
- angular - Angular 7中与打字稿类紧密耦合的地图服务器响应列表
- java - 如何在 gradle 3 或更高版本中使用 jar 文件?
- spring - springboot couchbase 每 20 个获取所有文档
- mysql - 具有计数功能的 MySQL 案例语句
- django - 如何在模板上返回并显示django中的用户名和组
- python - 如何修复“模块”对象不可调用
- azure - 使用 powershell 如何通过运行 ID 在 Azure 数据工厂中重新运行失败的管道?
- windows - DeviceIoControl 处理重叠和非重叠句柄的能力?
- scala - 为什么输出显示不正确?
- sql - 使用 SIGN 函数,但无法转换为负数