File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,7 +214,13 @@ account = customer.back_accounts.retrieve("bsbg7igxh3yukpu8t2q4")
214214Add subscription to customer
215215
216216``` python
217- customer.subscriptions.create(plan_id = " pbkliysxavp8bvvp8f0k" , trial_days = " 5" , card_id = " kvxvccpsesm4pwmtgnjb" )
217+ customer.subscriptions.create(plan_id = " pbkliysxavp8bvvp8f0k" , trial_end_date = " 2023/12/31" , card_id = " kvxvccpsesm4pwmtgnjb" )
218+ ```
219+
220+ Get customer subscriptions
221+
222+ ``` python
223+ customer.subscriptions.retrieve(" pbkliysxavp8bvvp8f0k" )
218224```
219225
220226Cancel subscription
@@ -234,7 +240,16 @@ Update subscription
234240
235241``` python
236242subscription = customer.subscriptions.all()[0 ]
237- subscription.cancel_at_end_period = True
243+ subscription.cancel_at_period_end = True
244+ subscription.save()
245+ ```
246+
247+ Change subscription card by token
248+
249+ ``` python
250+ subscription = customer.subscriptions.all()[0 ]
251+ subscription.card_id = " ppldmckf6ls94skdihkd"
252+ subscription.card = None
238253subscription.save()
239254```
240255
You can’t perform that action at this time.
0 commit comments