如何使用多种货币设置Paypal订阅



对于每种产品,我们都会执行以下操作:

  1. 添加新产品时,使用POST /v1/catalogs/products创建新产品
  2. 使用步骤1中的product_id创建新计划POST /v1/billing/plans
  3. 每当顾客点击";订阅";按钮,我们使用步骤2中的plan_idPOST /v1/billing/subscriptions创建一个新订阅

问题:创建订阅时,我们可以通过将plan对象传递到POST /v1/billing/subscriptions端点来覆盖计划金额,从而更改向客户计费的价格。然而,传入不同的货币会引发一个错误:

"The currency code is different from the plan's currency code."

话虽如此,有没有一种方法可以设置贝宝订阅,我们可以用不同的货币传递?是否需要为每种货币创建一个新的计划,因为这似乎不是一个好的解决方案

我们创建了一个包含以下主体的计费计划:

{
product_id: productId,
name: planName,
status: 'ACTIVE',
billing_cycles: [
{
frequency: {
interval_unit: 'MONTH',
interval_count: 1
},
tenure_type: 'REGULAR',
sequence: 1,
// Create a temporary pricing_scheme. This will be replaced
// with a variable amount when a subscription is created.
pricing_scheme: {
fixed_price: {
value: '1',
currency_code: 'CAD'
}
},
total_cycles: 0
}
],
payment_preferences: {
auto_bill_outstanding: true,
payment_failure_threshold: 2
}
}

我们使用以下主体创建订阅(但是传入与计划不同的货币(CAD(会引发错误(:

{
plan_id: planId,
subscriber: {
email_address: email
},
plan: {
billing_cycles: [
{
sequence: 1,
pricing_scheme: {
fixed_price: {
value: amount,
currency_code: currency
}
}
}
]
},
custom_id: productId
};

是否需要为每个货币创建新计划

最新更新