创建具有自定义试用期的 PayPal 订阅
Create PayPal subscription with custom trial duration
我有 2 周试用期的 PayPal 订阅,之后按月计费。
有一种情况我遇到了麻烦:如果用户在试用期间取消订阅,但随后决定创建一个新订阅怎么办?
客户不想给他全新的 2 周试用,他也不想让用户完全没有试用。理想情况下,如果用户在其原始试用期还剩 6 天,我们现在应该在开始时创建一个具有 6 天试用期的订阅。之后,照常按月计费。
有办法吗? plan
对象如下所示:
"name": "Test Plan",
"status": "ACTIVE",
"description": "Desc",
"usage_type": "LICENSED",
"billing_cycles": [
{
"frequency": {
"interval_unit": "WEEK",
"interval_count": 2
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 1
},
{
"pricing_scheme": {
"version": 1,
"fixed_price": {
"currency_code": "USD",
"value": "29.0"
},
"create_time": "2020-07-16T08:30:54Z",
"update_time": "2020-07-16T08:30:54Z"
},
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 2,
"total_cycles": 0
}
],
"payment_preferences": {
"service_type": "PREPAID",
"auto_bill_outstanding": true,
"setup_fee": {
"currency_code": "USD",
"value": "0.0"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
当我正常创建 subscription
时,我发送到 API 的所有内容是:
"plan_id" : "P-XXXXXXXXXXXXXXXX",
"application_context": {
"brand_name": "Name",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
我在文档中没有看到创建订阅时覆盖计费周期的选项:
https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create
我该怎么做(如果可行的话)?
对于不同的试用期长度,您需要创建一个新的具有不同试用期的Plan对象,并使用这个不同的Plan进行订阅。
我有 2 周试用期的 PayPal 订阅,之后按月计费。
有一种情况我遇到了麻烦:如果用户在试用期间取消订阅,但随后决定创建一个新订阅怎么办?
客户不想给他全新的 2 周试用,他也不想让用户完全没有试用。理想情况下,如果用户在其原始试用期还剩 6 天,我们现在应该在开始时创建一个具有 6 天试用期的订阅。之后,照常按月计费。
有办法吗? plan
对象如下所示:
"name": "Test Plan",
"status": "ACTIVE",
"description": "Desc",
"usage_type": "LICENSED",
"billing_cycles": [
{
"frequency": {
"interval_unit": "WEEK",
"interval_count": 2
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 1
},
{
"pricing_scheme": {
"version": 1,
"fixed_price": {
"currency_code": "USD",
"value": "29.0"
},
"create_time": "2020-07-16T08:30:54Z",
"update_time": "2020-07-16T08:30:54Z"
},
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 2,
"total_cycles": 0
}
],
"payment_preferences": {
"service_type": "PREPAID",
"auto_bill_outstanding": true,
"setup_fee": {
"currency_code": "USD",
"value": "0.0"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
当我正常创建 subscription
时,我发送到 API 的所有内容是:
"plan_id" : "P-XXXXXXXXXXXXXXXX",
"application_context": {
"brand_name": "Name",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
我在文档中没有看到创建订阅时覆盖计费周期的选项:
https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions_create
我该怎么做(如果可行的话)?
对于不同的试用期长度,您需要创建一个新的具有不同试用期的Plan对象,并使用这个不同的Plan进行订阅。