如何让客户在PayPal中使用不同的货币进行支付?

How to allow customers pay with different currencies in PayPal?

我正在尝试了解如何在 Java 中集成 PayPal Express Checkout,现在我首先通过发送以下请求成功应用了客户批准付款的场景,然后获得批准的 HATEOAS ref link:

curl -v -X POST https://api.sandbox.paypal.com/v2/checkout/orders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-d '{
  "intent": "AUTHORIZE",
  "purchase_units": [
    {
      "amount": {
        "currency_code": "USD",
        "value": "100.00"
      }
    }
  ]
}'

之后,我捕获了客户和卖家交易都正常的请求。但是当尝试用另一个 currency_code 支付时,例如 MAD 我得到以下错误:

{"name":"UNPROCESSABLE_ENTITY","details":[{"location":"body","issue":"CURRENCY_NOT_SUPPORTED","description":"Currency code is not currently supported. Please refer https://developer.paypal.com/docs/integration/direct/rest/currency-codes/ for list of supported currency codes."}],"message":"The requested action could not be performed, semantically incorrect, or failed business validation.","debug_id":"","links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-CURRENCY_NOT_SUPPORTED","rel":"information_link","method":"GET"}]}

是否有任何解决方法可以强制使用多种货币结账?或者如何实现货币转换?

MAD 不是 PayPal-supported 货币

完整列表如下:https://developer.paypal.com/docs/api/reference/currency-codes/

如果买家有不同当地货币的资金来源(例如使用 MAD 的信用卡),将在结帐时向他们显示转换。但您的交易必须以 PayPal 支持的一种货币计价,您将收到该货币。


最好的批准流程不是 link 或 redirect-based,而是让您的网站在后台加载并打开 in-context window。这是 front-end UI:https://developer.paypal.com/demo/checkout/#/pattern/server

它确实需要在页面加载时(或稍后 )知道货币。

您的服务器上需要两条相应的路由,一条用于 'Set Up Transaction',如您的问题,另一条用于 'Capture Transaction'。这里有一个指南:https://developer.paypal.com/docs/checkout/reference/server-integration/