问题描述
由于三天以来,我一直在尝试使Paypal Checkout正常工作,但我始终遇到这样的问题,即订单已创建,并且资金从购买帐户中消失了,但没有到达收款人帐户中.所以这是我的设置:
Since three days i am trying to get the Paypal Checkout to work but i always have the problem that the order is created and the money in gone from the buying account but not reaching the payee account.So here is my setup:
JavaScript中的智能按钮整数:
paypal.Buttons({
env: enviroment,
// Set up the transaction
createOrder: function() {
let formData = new FormData();
formData.append('bookingId', bookingId);
return fetch (url_createOrder, {
method: 'POST',
body: formData
}).then(response => {
console.log(response);
return response.json()
})
.then(function(res) {
console.log(res);
return res.result.id;
});
},
// Finalize the transaction
onApprove: function(data, actions) {
console.log(data);
// This function captures the funds from the transaction.
return actions.order.capture().then(function(details) {
console.log(details);
// This function shows a transaction success message to your buyer
// window.location.href = 'danke.php';
});
}
}).render('#paypal-button-container');
您可以看到 createOrder启动对此脚本的AJAX调用:
[...]
$client = new PayPalHttpClient($environment);
$request = new OrdersCreateRequest();
$request->prefer('return=representation');
$request->body = self::buildRequestBody($price);
// 3. Call PayPal to set up a transaction
$response = $client->execute($request);
echo json_encode($response, JSON_PRETTY_PRINT);
// 4. Return a successful response to the client.
return $response;
}
private static function buildRequestBody($price) {
return array(
'intent' => 'CAPTURE',
'application_context' => array(
'brand_name' => 'Example',
'cancel_url' => 'http://localhost/example/abbruch.php',
'return_url' => 'http://localhost/example/danke.php'
),
'purchase_units' => array(
0 => array(
'reference_id' => 'example_addr',
'description' => 'example Address',
'amount' => array(
'currency_code' => 'EUR',
'value' => $price
)
)
)
);
[...]
到目前为止,一切正常.我得到一个OrderId,返回到AJAX调用,然后我可以插入凭据并支付给定的价格.
Everything works so far to this point. I get a OrderId back which i return to the AJAX call and then i am am able to insert credentials and pay the given price.
当我完成付款后,JS文件中的智能按钮的onApprove会被调回,并且我也会收到正确的 actions.order.capture()响应:
When i finish the payment the onApprove of the smart buttons in the JS file get called back and i also get the correct response of that actions.order.capture():
{create_time: "2020-08-14T19:37:59Z", update_time: "2020-08-14T19:38:20Z", id: "6FP46164U47878440", intent: "CAPTURE", status: "COMPLETED", …}
create_time: "2020-08-14T19:37:59Z"
id: "6FP46164U47878440"
intent: "CAPTURE"
links: [{…}]
payer:
address:
country_code: "DE"
__proto__: Object
email_address: "[email protected]"
name: {given_name: "John", surname: "Doe"}
payer_id: "8Z5RM2ERW6VTL"
__proto__: Object
purchase_units: [{…}]
status: "COMPLETED"
update_time: "2020-08-14T19:38:20Z"
__proto__: Object
此后,钱从买家帐户中扣除,但显示为待处理",此处为屏幕截图(但以德语显示) payment_is_pending.png
Afterwards the money is gone from the buyer account but it says "pending", here a screenshot (but in german)payment_is_pending.png
在卖方帐户上,我无法选择批准"之类的内容.我找到了一个与Paypal Checkout API相似的示例,并试图将其复制到我的代码中,但是是的.然后我认为问题可能出在卖方沙箱帐户上,但是如果我尝试使用,则由贝宝教程创建并给出的沙箱帐户也将处于待处理状态.
On the seller account i can´t select anything like "approve". I found an example of the paypal checkout api which works similar and tried to copy it into my code but yeah... same story.Then i thought maybe the problem is the seller sandbox account, but if i try it which an sandbox account created and given by a paypal tutorial is says pending as well.
请帮助!
推荐答案
付款正在处理中,因为不存在带有[email protected]电子邮件确认的沙箱帐户,已确认,因此付款处于无人认领的状态.如果无人认领,待处理的无人认领付款将在30天后自动退还.
The payments are pending because there is no sandbox account with the email [email protected] confirmed, so the payments are in an unclaimed state. Pending unclaimed payments will be automatically returned after 30 days if left unclaimed.
要申领付款,必须在沙箱帐户上通过 https://www.sandbox.paypal.com/businessprofile/settings/email 和 https://developer.paypal.com/developer/notifications/
To claim the payments, the email [email protected] must be confirmed on a sandbox account, via https://www.sandbox.paypal.com/businessprofile/settings/email and https://developer.paypal.com/developer/notifications/
这篇关于贝宝结帐-付款始终处于待处理状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!