#pcrobinz

1 messages ยท Page 1 of 1 (latest)

dense egretBOT
warm otter
#

Hello ๐Ÿ‘‹
Are you using Stripe Checkout OR are you creating subscriptions by calling the API?

upper imp
#

hi, im creating subscription by calling the api

warm otter
#

Gotcha. In that case you can either listen for customer.subscription.created webhook event OR call the API to retrieve subscription object.

upper imp
#

i just dont get the process.

const {error} = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
});

how can i proceed with that if by creating subscription with trial period wont produce clientsecret

warm otter
#

The status should reflect the state subscription is in.

#

Oh are you trying to collect payment method details at the same time?

upper imp
#

ahhh i see. what im doing is collecting payment details first before creating subscription

#

im following this. "Collect payment details before creating an Intent"4

#

would the card details be validated by the payment element form?

upper imp
#

im following that guide, i think i was just confused with that process

#

correct me if im wrong

#

so basically, when a subscription is created with trial period. i dont need to confirm the payment right?

#

i just need to listen to the hook, that when the trial ends, if the payment is successful ill just continue his subscription, and if the payment is not successful, i need to stop his subsciption

warm otter
#

So, a subscription with trial would still need an attached payment method that we can charge after the trial ends

upper imp
#

with this code.
how can i save the payment details?

dense egretBOT
warm otter
#

So when you have a subscription with trial, there's no associated PaymentIntent but there is a pending_setup_intent property that allows you to capture the PaymentMethod information

#

So you'd change the confirmPayment function to confirmSetup instead

upper imp
#

ok currently checking

#

stripe.confirmSetup({the setup intent});

is this correct?

devout orbit
#

๐Ÿ‘‹ stepping in

#

No you pass the pending_setup_intent.client_secret to confirmSetup

#

Or, if you are rendering Payment Element you pass your elements object

upper imp
#

i think i should create setupintent after creating the subscription??

devout orbit
#

No a Subscription that has a trial automatically creates a SetupIntent and it is returned in the pending_setup_intent property

upper imp
#

then how can i use this in confirmsetup? i tried putting that, but it said i need to put clientsecret

devout orbit
#

Yep so when you create the Sub you want to expand the pending_setup_intent

#

Are you familiar with expansion?

upper imp
#

thank you very much mate

devout orbit
#

Sure

upper imp
#

can i also ask some few questions?

devout orbit
#

Yep

upper imp
#

so after 30days, stripe will automatically charge the card right?

#

then i can listen to webhook if the payment is successful or not, so i can pause or continue the subcsription of an user?

devout orbit
#

If the Subscription is on a monthly Price then yes

upper imp
#

i set the subscription to yearly

devout orbit
#

Oh well then it will renew yearly

upper imp
#

sorry for the confusion, i mean after 30days trial, stripe will automatically charge the card right?

#

then i can listen to webhook if the payment is successful or not, so i can pause or continue the subcsription of an user?

devout orbit
#

Oh yes that's correct.

upper imp
#

Okay thanks. Also for the test-clocks