三天以來,我一直在努力讓 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 教程創建和提供的沙盒帳戶也會顯示待處理。請幫忙!
Paypal Checkout - 付款始終處于待處理狀態
慕蓋茨4494581
2023-01-06 16:03:43