英文:
Stripe : Shift my customer from one product's recurring price plan to the same product's new recurring price plan?
问题
Question: 如何将我的客户从一个产品的重复价格计划转移到同一产品的新重复价格计划?
我所做的:
a) 通过API创建了一个产品
b) 在该产品下创建了一个价格计划
c) 现在我已经创建了一个客户
d) 客户购买了价格计划
e) 现在我的网站管理员想要更新价格计划的价格(之前是每天10美元,现在他想要每天12.5美元),问题从这里开始:
-
由于Stripe不允许在有人订阅此计划后更改价格计划的价格,我无法更新现有的价格计划。
-
增加数量以更新价格计划的价格在这里不是一个选项,因为不能通过数量来管理0.5的值(从10美元变为12.5美元)。
-
删除价格计划并创建一个新的价格计划将不起作用,因为我的老客户仍然会收取旧价格。
如何解决这个问题?如何将我的老客户与这个新价格计划绑定在一起?
**注意:**我已成功在同一产品下创建了一个新的价格计划。请帮助我实现我的目标。谢谢!
英文:
Question: How to shift my customer from one product's recurring price plan to the same product's new recurring price plan?
What I did:
a) Created a product Via API
curl https://api.stripe.com/v1/products \
-u sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx: \
-d name="Daily Subscription"
b) Created a price plan under this product:
curl https://api.stripe.com/v1/prices \
-u sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx: \
-d unit_amount=1000 \
-d currency=usd \
-d "recurring[interval]"=day \
-d product=prod_xxxxxxxxxxx [I got it from the first API hit response]
c) Now I have created a customer:
curl https://api.stripe.com/v1/customers \
-u sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx: \
--email="alive-to-die@gmail.com"
--name="alive-to-die"
d) Bought plan by the customer:
curl https://api.stripe.com/v1/checkout/sessions \
-u sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxx: \
--data-urlencode success_url="https://example.com/success" \
-d "line_items[0][price]"=price_xxxxxxxxxxxxxx \ [I got it from price plan API hit response]
-d "line_items[0][quantity]"=1 \
-d mode=payment
e) Now the Admin of my site wants to update the plan price (Previously it was $10 per day now he wants it to be $12.5 per day), and the issue starts from here:
- Since Stripe does not give the option to update the plan price once anyone subscribes to this plan, I am unable to update the existing plan price. As it is stated here: Update a plan
>You cannot change a plan's ID, amount, currency, or billing cycle.
-
Increasing the quantity to update the plan price is not an option here as 0.5 value can not be managed via quantity. (change from $10 to $12.5)
-
Deleting the price plan and creating a new price plan will not work as my old customer will still charge the old price. As it is stated here: Delete a plan
>Deleting plans means new subscribers can’t be added. Existing subscribers aren’t affected.
How to overcome this issue? How to bind my old customers with this new price plan?
Note: I have already created a new price plan under the same product successfully as well.
Please help me to achieve my goal.
Thanks
答案1
得分: 3
要将现有客户切换到新的价格计划,您需要在Stripe中更新他们的订阅。以下是逐步指南:
-
使用其customer_id检索客户的现有订阅。这可以通过使用List subscriptions API来完成。请将customer_id替换为实际的客户ID。
-
从响应JSON中获取订阅ID。使用您想要切换到的新价格ID设置新的items数组:
-
使用新的items数组更新订阅:
curl https://api.stripe.com/v1/subscriptions/sub_ID \
-u sk_test_...: \
-X POST \
-d "items[0][id]"="item_ID" \
-d "items[0][price]"="new_price_ID" \
-d "proration_behavior"="create_prorations"
在上面的代码片段中,将sub_ID、item_ID和new_price_ID分别替换为实际的订阅ID、项目ID和新价格ID。
请注意,此方法默认会按比例分配订阅。如果您不想要按比例分配,可以将proration_behavior更改为none。
之后,客户将订阅新的定价计划。但是,您可能希望发送通信,例如电子邮件,通知客户有关更新后的定价。
更多详细信息可以在此指南中找到。
英文:
To shift your existing customer to the new price plan, you need to update their subscription in Stripe. Here's a step-by-step guide:
-
Retrieve the existing subscription for the customer using their customer_id. This can be done using the List subscriptions API. Please replace customer_id with the actual customer ID.
-
From the response JSON, get the subscription ID. Set the new items array with the new price ID you want to switch to:
-
Update the subscription with the new items array:
curl https://api.stripe.com/v1/subscriptions/sub_ID \
-u sk_test_...: \
-X POST \
-d "items[0][id]"="item_ID" \
-d "items[0][price]"="new_price_ID" \
-d "proration_behavior"="create_prorations"
In the above code snippet, replace sub_ID, item_ID, and new_price_ID with the actual subscription ID, item ID, and the new price ID respectively.
Please note that this method would prorate the subscription by default. If you do not want proration, you can change the proration_behavior to none.
After this, the customer would be subscribed to the new pricing plan. However, you may want to send communication, such as an email, informing the customer of the updated pricing.
More details can be found in this guide.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论