#vlad-ko_subscription-intent-mismatch
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/1422254003080663074
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
What exactly is the error you are seeing, what steps are you taking, and when does the error occur?
on backend i rewrite the logic - initially i was looking for latestInvoiceObject?.paymentIntentObject?.clientSecret
i want to collect the payment details in advance and give the users free period for N days
i change the logic to
hasTrialOption -> stripeSubscription.pendingSetupIntentObject.clientSecret
hasNoTrialOption -> stripeSubscription.latestInvoiceObject.paymentIntentObject.clientSecret
subscription setup is like that
And it sounds like one of those options is not returning a valid client secret, right?
SubscriptionCreateParams.TrialSettings.EndBehavior.builder()
.setMissingPaymentMethod( -> MissingPaymentMethod.CANCEL
.setPaymentBehavior(SubscriptionCreateParams.PaymentBehavior.DEFAULT_INCOMPLETE)
- .addExpand("latest_invoice.payment_intent")
.addExpand("pending_setup_intent")
I will try now with SubscriptionCreateParams.TrialSettings.EndBehavior.builder()
.setMissingPaymentMethod( -> MissingPaymentMethod.CREATE_INVOICE
do you need subscription id
Sorry but that makes no sense to me
you can check this one sub_1SCiJMCOtHrcpcR8FrGfukuA (old code)
All I'm asking is which option is resulting in the client secret error?
if i add this .setTrialPeriodDays(createRequest.trialPeriodInDays) the payment on ios is failing with the error above
if i don't have trial -> all good (sub_1SCiHgCOtHrcpcR8sYMfEQPz)
Okay so let's focus on the subscription with the trial period days
Can you log the client secret?
will need some time add deploy the logging
Wait a sec. Looking at the code screenshot, it looks like what is failing is a check to validate the client secret matches for a Payment Intent
But you are returning a client secret for a Setup Intent
So that's expected
pendingSetupIntentObject.clientSecret: seti_1SCjvXCOtHrcp...._secret_T91zE3T4T2n2mO2....
latestInvoiceObject.paymentIntentObject.clientSecret: null
Wait a sec. Looking at the code screenshot, it looks like what is failing is a check to validate the client secret matches for a Payment Intent
but this is wrong setup on client (ios) side
?
Sorry but none of that makes any sense to me
Why would this be a wrong setup on client side? what do you mean by that?
sorry i am backend dev and ios development is done by someone else
And that is where the error is being thrown, correct?
yes, on ios payment sheet or what is used by the dev guy
STPPaymentIntentParams.isClientSecretValid(secret)
Yeah so the problem here is this like of code is checking for a Payment Intent client secret
When you include a free trial, you are returning a Setup Intent client secret
The iOS code is not handling that properly
so he needs to know if we have a trial option or to tell him what kind of secret i will send
and based on that he needs to validate different client secrets
The iOS code needs to check whether or not the Subscription includes a trial and route the code execution properly
can sdk do the check or should i provide him the details in the payload from our backend (if you know, we will check it any way)
i think it is clear to me now
thanks
Great, happy to help
i was thinking that it is something like that
but I was not sure when I have SetupIntent and PaymentIntent
When Subscriptions have free trials, we send a Setup Intent so you can collect payment method details
But when there are no free trials, there is a Payment Intent so you can collect payment
thanks, mate and have a great day
You too ๐