三天以來,我試圖讓 Paypal Checkout 正常工作,但我總是遇到這樣的問題:訂單已創(chuàng)建,資金從購買帳戶中消失,但未到達(dá)收款人帳戶。這是我的設(shè)置: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 調(diào)用:[...]$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 調(diào)用,然后我就可以插入憑據(jù)并支付給定的價格。
1 回答

慕尼黑5688855
TA貢獻(xiàn)1848條經(jīng)驗 獲得超2個贊
由于沒有電子郵件地址為sb-2xact2876961@business.example.com已確認(rèn)的沙盒帳戶,因此付款處于待處理狀態(tài),因此付款處于無人認(rèn)領(lǐng)狀態(tài)。如果無人認(rèn)領(lǐng),待處理的付款將在 30 天后自動退回。
- 1 回答
- 0 關(guān)注
- 289 瀏覽
添加回答
舉報
0/150
提交
取消