You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PayPal REST API将Payin3设为默认支付方式

问题

希望客户点击网站上自定义的Payin3按钮后,跳转至PayPal页面时默认选中Payin3而非PayPal余额,请问通过REST API该如何实现?

当前未达成需求的API请求代码如下:

{
   "intent":"CAPTURE",
   "purchase_units":[
      {
         "reference_id":"58Y18137NX645002L",
         "amount":{
            "currency_code":"GBP",
            "value":"120.00"
         }
      }
   ],
   "payment_source":{
      "paypal":{
         "experience_context":{
            "payment_method_preference":"IMMEDIATE_PAYMENT_REQUIRED",
            "payment_method_selected":"PAYLATER",
            "brand_name":"EXAMPLE INC",
            "landing_page":"LOGIN",
            "shipping_preference":"SET_PROVIDED_ADDRESS",
            "user_action":"PAY_NOW",
            "return_url":"https://example.com/returnUrl",
            "cancel_url":"https://example.com/cancelUrl"
         }
      }
   }
}

当前效果截图:
PayPal页面当前效果,默认选中PayPal余额选项

解决方案

问题出在你当前使用的payment_method_selected参数值太宽泛:PAYLATER涵盖了PayPal所有"先买后付"类产品,无法精准指定Payin3。要实现默认选中Payin3,需按以下方式调整API请求参数:

  • 将experience_context中的payment_method_selected值从PAYLATER改为PAY_IN_3,这是PayPal REST API中对应Payin3的专属标识符。
  • 保留payment_method_preference为IMMEDIATE_PAYMENT_REQUIRED,确保用户必须使用指定的支付方式完成交易(若用户符合Payin3使用条件)。

修改后的完整请求代码:

{
   "intent":"CAPTURE",
   "purchase_units":[
      {
         "reference_id":"58Y18137NX645002L",
         "amount":{
            "currency_code":"GBP",
            "value":"120.00"
         }
      }
   ],
   "payment_source":{
      "paypal":{
         "experience_context":{
            "payment_method_preference":"IMMEDIATE_PAYMENT_REQUIRED",
            "payment_method_selected":"PAY_IN_3",
            "brand_name":"EXAMPLE INC",
            "landing_page":"LOGIN",
            "shipping_preference":"SET_PROVIDED_ADDRESS",
            "user_action":"PAY_NOW",
            "return_url":"https://example.com/returnUrl",
            "cancel_url":"https://example.com/cancelUrl"
         }
      }
   }
}

注意:此配置仅在用户满足Payin3的使用要求(包括地区限制、金额范围、信用资质等)时生效。若用户不符合条件,PayPal会自动展示其可用的其他支付方式。

内容的提问来源于stack exchange,提问作者Jameel Ahmed Ansari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 18:40:59