三天以来,我一直在努力让 Paypal Checkout 正常工作,但我总是遇到这样的问题:订单已创建,购买账户中的钱没有到达收款人账户。所以这是我的设置: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' )到目前为止一切正常。我得到一个 OrderId,我返回到 AJAX 调用,然后我能够插入凭据并支付给定的价格。之后钱从买家账户中消失,但显示“待定”,这里是截图(但是德语) payment_is_pending.png在卖家帐户上,我无法选择“批准”之类的任何内容。我找到了一个类似 paypal checkout api 的例子,并试图将它复制到我的代码中,但是是的......同样的故事。然后我想问题可能出在卖家沙盒帐户上,但如果我尝试它,那么由 paypal 教程创建和提供的沙盒帐户也会显示待处理。请帮忙!
1 回答

素胚勾勒不出你
TA贡献1827条经验 获得超9个赞
付款处于待处理状态,因为没有电子邮件为 sb-2xact2876961@business.example.com confirmed的沙盒帐户,因此付款处于无人认领状态。如果无人认领,待处理的无人认领付款将在 30 天后自动退还。
要领取付款,必须通过https://www.sandbox.paypal.com/businessprofile/settings/email和https://developer.paypal在沙盒帐户上确认电子邮件 sb-2xact2876961@business.example.com .com/developer/notifications/
添加回答
举报
0/150
提交
取消