#TomPham
1 messages · Page 1 of 1 (latest)
heya @wanton galleon , sorry i didn't really understand the scenario. what is the checkout mode you're using? https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-mode
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I use the script code of stripe checkout button
there's really only 3 options : payment, subscription or setup - can you check your code and let me know which is it?
And render the total amount to charge from creating a price id
It is payment
But the price id that the client pay is set up as interval "month". As I understand it is like subscription because it will charge again for the month after, will it?
You will not be able to create a Checkout Session using payment mode, with a Price that has an interval "month"
it will return an error
At start I create a price to send the price id to the front end
And in front end it receive the price Id to charge the amount that I set up
I did like this and it succeeded
your mode is "subscription" in your code
not payment
so it's essentially creating a subscription
Could you give me an example?
How can I render a subscribe button in front end then?
And what do I have to do in order to stop subscription of a client?
I didn't have to create subscription with stripe.subscription.create method
But It really works, as you can see below
What I created and when the client paid it goes inside the subscription. That's why I believe I made it as a subscription
And if it was already a subscription, how can I cancel this subscription when client chose to cancel payment? (Since I do not have subscription id cos it was redirect to create a subscription from frontend). I only thing I have is price ID, can I update {active: false} to ensure the subscription of client for this price is canceled?
@wanton galleon because the Checkout mode is subscription, Stripe will automatically create the subscription
to cancel the subscription, you can either call the API : https://stripe.com/docs/api/subscriptions/cancel
or do it via the Dashboard
Since I let the frontend redirect to create the subscription then in the backend I do not have the subscription Id, that is why I cannot use this api. Is there any other option than those two?
And what will happen if I set the field "active" of price as "false"?
setting Price active=false would only prevent new Subscription creation using that Price. It won't cancel payments of existing subscriptions
you could possibly implement the customer portal to allow customers to cancel their own subscriptions : https://stripe.com/docs/billing/subscriptions/customer-portal
Thank you for the information