指定货币SGD的PayPal API



我正在开发一个支付系统与PayPal的API。一切正常,除了交易是用美元而不是新元(就像我想要的那样)。

PayPal Button from react-paypal-button-v2

<PayPalButton
currency='SGD'
amount={parcel.basePrice}
onSuccess={successPaymentHandler}
/>

添加PayPal按钮的脚本

const addPayPalScript = () => {
const script = document.createElement("script");
script.type = "text/javascript";
script.src =
"https://www.paypal.com/sdk/js?client-id=CLIENT_ID&currency=SGD";
script.async = true;
script.onload = () => {
setSdkReady(true);
};
document.body.appendChild(script);
};

我遵循这里的文档。https://developer.paypal.com/docs/checkout/reference/customize-sdk/

SGDis一个PayPal支持的货币,根据非官方的react-paypal-button-v2组件的文档,你的代码的用法似乎是正确的,所以我不确定这里出了什么问题。

试试更新的官方@paypal/react-paypal-js。

你可以在选项中使用货币而不是在组件代码中作为道具。

<PayPalButton
amount={100}
options={{            
currency:"SGD"
}}

/>

最新更新