#vlad-ko_api
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1352658022249533574
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
previous spoke with i think @compact sonnet, and he suggested to get the payment intent from the latest invoice but when the subscription is created as trial it is null
Hi, we document how it works here: https://docs.stripe.com/billing/subscriptions/trials#create-free-trials-without-payment
When you create the subscription you can set the trial days: https://docs.stripe.com/api/subscriptions/create#create_subscription-trial_period_days or the timestamp for the trial end: https://docs.stripe.com/api/subscriptions/create#create_subscription-trial_end
This is what you'd want to look at: https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=ios
Are you able to review the above documents, and let me know what questions you have?
wait
the whole logic is driven by the backend
everything is created on the back and for the mobile we want to show just the paymentSheet
yes i read the above documents and the logic is working perfectly so far for the hosted (for the web) version
but now we are trying to implement the mobile way (using the mobile sdk)
check this subscription - sub_1R56lxCOtHrcpcR8TYkaLrCE (it should be ok)
the problem is that i have EphemeralKey, publishableKey but cannot get PaymentIntentSecret because stripeSubscription.latestInvoiceObject.paymentIntentObject is null
I guess because the subscription is in trial state
When i am creating a subscription via SessionCreateParams.builder()....etc. somehow I have an invoice with zero amount for paying - previously the plan was to initiate the mandate for BACS so that when the trial ends to start collecting money from the bank account (but know the plan is to pay with card and start collecting payments from this payment method)
if i should listen for trial_end event, it will be nightmare - maybe i am missing something which need to be instructed/attached to subscription object
Let me grab someone who has more mobile experience, hang tight
take your time
Hey @keen smelt -- when subscriptions are started with a trial, then instead of the latest_invoice.payment_intent you need to look at the Subscription pending_setup_intent and get the setup intent client_secret from there
ie, there is no payment for a trial, so there is no payment intent
instead there is a setup intent
(the trial invoice is $0)
i will try it
btw
do i need to expand it like this .addExpand("latest_invoice.payment_intent")
also is it safe to get it from pending_setup_intent for both cases - trial and non trial subscriptions
So instead of paymentIntentClientSecret you provide setupIntentClientSecret
https://docs.stripe.com/billing/subscriptions/build-subscriptions?platform=ios#add-the-payment-element-to-your-app
Like it is shown here for a non-subscription scenario:
https://docs.stripe.com/payments/mobile/set-up-future-payments?platform=ios&mobile-ui=payment-element
Yes, you can expand both safely and just inspect the one that exists
.addExpand("latest_invoice.payment_intent")
.addExpand("pending_setup_intent")
only one of these will exist at a time
either there is a payment due at the start or there is not
for the checkout session the key to collect payment details was this line defaultSessionCreateParamsBuilder.setPaymentMethodCollection(SessionCreateParams.PaymentMethodCollection.ALWAYS)
for mobile sdk is more tricky ๐
ok i will try it and create new thread if I still have issues
can i use the thread for almost related question ๐
correct me if i am wrong but when a card is expired there is a channel (protocol) which stripe is using to acquire the new card details so that there is no interruption, right? and this feature should be asked for - my boss (then owner of the account) should contact stripe's reps. what will happen if the card is terminated and never renew or the communication fails to get the new details
at least we will need to watch for unpaid subscription's invoices (webhook events)
Hi! Jumping in for my colleague. We will notify you if/when a card is updated.
As for Subscriptions, ya, watch for the appropriate Invoice and Subscription events and act accordingly. ๐
You're welcome! ๐