我嘗試使用貝寶支付 1 歐元。它向我表明它是成功的。它完成了我的 onApprove 功能中的所有操作,并且沒有顯示錯誤,但是當我檢查我的 2 paypal 帳戶時,沒有匯款!一個賬戶的余額既不會減少,另一個賬戶的余額也會增加。
有任何想法嗎?
const initialOptions = {
'client-id': 'MY_CLIENT_ID',
components: 'buttons',
'data-namespace': 'PayPalSDK',
currency: 'EUR',
intent: 'capture',
'enable-funding': ['sofort', 'giropay'],
'disable-funding': ['card', 'sepa'],
};
<PayPalButtons
key={Math.random()}
createOrder={(data, actions) => {
return actions.order.create({
purchase_units: [
{
description: 'Restaurant',
amount: {
value: carttotal,
currency_code: 'EUR',
}
},
],
application_context: {
shipping_preference: 'NO_SHIPPING',
},
});
}}
onApprove={(data, actions) => {
actions.order.capture().then(() => {
axios
.post(
'/api/paypal',
{
cartItems: cartItems,
}
)
}
}}
onCancel={() => {
toast.error('Cancel', {
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
one rror={() => {
//setPaid(false);
toast.error('Error', {
position: toast.POSITION.BOTTOM_RIGHT,
});
}}
/>
uj5u.com熱心網友回復:
您正在使用 actions.order.create() 在客戶端創建訂單以供批準,但批準后沒有呼叫 actions.order.capture(),因此沒有創建交易。
(如果您需要存盤結果或對交易結果執行任何自動化操作,則不應使用這些服務器端函式中的任何一個,而應使用 v2/checkout/orders API 在后端創建和捕獲,并與前端配對呼叫那些后端路由。)
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/527795.html
