问题描述
我正在使用 PayPal API 开发支付系统。一切正常,除了交易是美元而不是新加坡元(就像我想要的那样)。
来自 react-paypal-button-v2 的 PayPal 按钮
<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¤cy=SGD";
script.async = true;
script.onload = () => {
setSdkReady(true);
};
document.body.appendChild(script);
};
我遵循了此处的文档。 https://developer.paypal.com/docs/checkout/reference/customize-sdk/
解决方法
SGD 是 PayPal supported currency,根据非官方 react-paypal-button-v2 组件的文档,您的代码用法似乎是正确的,所以我不知道这里出了什么问题。
尝试使用较新的官方 @paypal/react-paypal-js。