#AlexElba-billing
1 messages · Page 1 of 1 (latest)
Hello, so I am trying to follow tutorial , but can not figure out
where to add
createPaymentMethod
function call
heya @merry jacinth! actually that guide seems to have gotten the code wrong and I'll let the relevant team know that we need to fix this.
To answer your question, yes, that method should be called in submit
You may want to consider looking at these samples instead on Github : https://github.com/stripe-samples/subscription-use-cases/tree/v1.0/fixed-price-subscriptions
so the create subscription is done server side not with js on client side?
can it be done directly in js https://github.com/stripe-samples/subscription-use-cases/blob/v1.0/fixed-price-subscriptions/client/vanillajs/subscribe.js
await fetch('/create-subscription' ...
instead of doing a server side call to create subscription
@merry jacinth your question was specifically with regards to creating the payment method - the payment method is created from the client with stripe.js. After the payment method is created, your client would make an API call to your server to create the subscription with the payment method id
so to be clear for my steps Form -> Name, email, phone, price_id Submit -> 1) Ajax call to create a customer and return customer id 2) with customer id in javascriptipt create payment method 3) On successful payment do ajax call to create subscription
is this correct flow?
yep sounds correct from a high level perspective