#smileydev-subscription-update
1 messages ยท Page 1 of 1 (latest)
It works the same for quantity or price, no difference, you use https://stripe.com/docs/api/subscriptions/update and update the corresponding subscription item's quantity, or you use https://stripe.com/docs/api/subscription_items/update for a specific one
yea, i tried with the first approach.
curl https://api.stripe.com/v1/subscriptions/sub_1JjMq2BicaHE28ep2xNfVtVH \
-u sk_test_xxxx: \
-d "items[0][price]"=price_xxx \
-d "items[0][quantity]"=3```
what I am missing here?
mostly that doesn't work at all :p
That call adds a separate Price to the existing Subscription
-u sk_test_xxxx: \
-d "items[0][id]"=si_12345 \
-d "items[0][quantity]"=3```
you want ^, you explicitly replace the existing SubscriptionItem id for the current price to change its quantity (or price)
haha let me check soon. please wait lol
๐ it works now
btw, is it right to get subscription info from the customer?
Its the best approach using if I have a customer id.
I would recommend storing that information in your database instead
I would store the customer id, the subscription id, all the subscription item ids, the quantity, the Prices, etc.
I wouldn't load it from Stripe if it were me. But otherwise yes you can use https://stripe.com/docs/api/subscriptions/list + customer: 'cus_123'
Thank you
by the way, its okay for increasing quantity, otherwise if I decrease the quantity, how can the remaining money be handled? refund? or for the next invoice?
hey there!
When you have prorations that create credits exceeding any other balance owed, the credit is added to the customer balance and yes, is used against future invoices.
If you wanted to issue refunds to your customers, you can certainly choose to do that
Thank you @mighty wren , another question, is it possible to payout to the customer from the owner? I have used connect account for this, but I am curious with your message.
I'm not sure what you mean, can you rephrase or provide an example?
sorry for the delay, so far what i have done is about customers can pay the owner with their credit card or bank or so, but opposite feature is possible?
Hello! You want to be able to send money to your customers you mean?
Hmmm, As a user of the platform, if a user wants to have two feature as well, user should have two types? customer and connect account?
otherwise with connect account they can deposit or payout, right?
i am not sure... ๐
It depends on the specifics of your use case and implementation, but yes, you might have both a Customer and a Connect account that are associated with the same person.
Yea, I got it. thank you so much @torn mantle its okay to close this thread. ๐
Sounds good! Have a great day!