我在与 PayPal 进行付款集成时遇到问题。我正在使用 REST API,这是我用于创建订单的代码:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.sandbox.paypal.com/v2/checkout/orders",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{
"intent": "CAPTURE",
"purchase_units": [
{
"reference_id": "PUHF",
"amount": {
"currency_code": "PLN",
"value": "100.00"
}
}
],
"application_context": {
"return_url": "http://www.mywebside.com",
"cancel_url": ""
}
}',
CURLOPT_HTTPHEADER => array(
'accept: application/json',
'accept-language: en_US',
'authorization: Bearer '.$access_token.'',
'content-type: application/json'
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
我在沙箱环境中工作。我进入支付页面并转移虚拟货币。当它将我重定向到我的网站时,我会检查订单状态。状态的值为“已批准”而不是“已完成”,并且资金也不会记入帐户。这取决于什么?
jeck猫