Paypal REST api - 如何控制显示语言?

时间:2014-05-07 17:06:29

标签: php paypal localization

我正在使用官方PHP SDK开发PayPal REST API:https://github.com/paypal/rest-api-sdk-php

但是我注意到REST调用指向中文语言环境中的签出页面(沙盒模式),是否知道如何将显示语言控制为英语?

我发现一年前问了同样的问题,但没有答案:REST Api integration - how to force payment page's language?

或者基于Classic API提供任一解决方案,看起来不适用于REST API: How can I control the language displayed in the Paypal Sandbox?

3 个答案:

答案 0 :(得分:3)

您可以将任何LOCALE选项传递给REST API,但是,如果您为交易设置了送货地址,则应自动更新。您可以通过以下电话进行测试。

curl -v https://api.sandbox.paypal.com/v1/payments/payment -H 'Content-Type: application/json' -H 'Authorization: Bearer {ACCESS_TOKEN}' \
-d '{
  "intent":"sale",
  "redirect_urls":{
    "return_url":"http://localhost",
    "cancel_url":"http://localhost"
  },
  "payer":{
    "payment_method":"paypal"
  },
  "transactions":[
    {
        "amount":{
            "total":"7.47",
            "currency":"USD"
        },
        "item_list":{
            "shipping_address":{
                "recipient_name":"Test Test",
                "type":"business",
                "line1":"187 Alameda Santos",
                "city":"Sao Paulo",
                "country_code":"BR",
                "postal_code":"01119",
                "state":"Condominio Edificio Platinum"
            }
        },
        "description":"This is the payment transaction description."
    }
  ]
}'

答案 1 :(得分:0)

除了Aaron的回答,您可以使用ExpressCheckout REST api设置LOCALE,请参阅https://developer.paypal.com/webapps/developer/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/

答案 2 :(得分:0)

您可以使用 PayPal REST APIS传递此处的语言环境参数- https://developer.paypal.com/docs/api/payments/v1/

示例

"application_context":{
    "locale":"en_IN",
    "brand_name":"MY BRAND",
    "landing_page":"Billing"
}