#_nerder
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- _nerder, 2 days ago, 5 messages
- _nerder, 3 days ago, 9 messages
- _nerder, 3 days ago, 91 messages
- nerder-connect, 3 days ago, 29 messages
- _nerder, 4 days ago, 34 messages
Hi there ๐ what's the error you're running into, and is it being surfaced in a response to a request you're making? If so, can you share that request ID as well?
req_dty6TIySHR0BH3
here you have it
is something to do with how i confirm the payment intent
but there must be a mistake on how i create the invoice
because for subscriptions it works fine
I think Checkout is the piece that is handling this. I'm currently looking to see how you're creating that one-off Invoice.
ok
there is this piece of code which is kinda sus:
const paymentIntent = await this.stripe.paymentIntents.update(
invoice.payment_intent as string,
{
setup_future_usage: 'off_session',
},
{
stripeAccount,
},
);
You're trying to use a Payment Method that has already been set up for future usage, correct? If so, I don't think you need to set setup_future_usage the way you're showing in that code snippet.
Umm, i'm always a bit confused with this
the checkout session will setup the payment for future usage I guess
but for instance in subscriptions i do something similar
const stripeSub: Stripe.Subscription = await this.stripe.subscriptions.create(
{
customer: customerId,
items: [
{
price: subscriptionPlan.code,
},
],
///..other stuff
off_session: true,
},
{
stripeAccount: stripeAccount,
},
);
and the docs says: Indicates if a customer is on or off-session while an invoice payment is attempted.
so my idea here was that by updating the payment intent for the invoice that i'm creating manually this will basically be the same as setting off_session for the subscription to true
But the confirmation attempt for the Payment Intent is coming from your frontend code, which makes it seem like that does happen when the customer is on session.
Well yes, my integration returns the client_secret back to the frontend the the payment intent is confirmed there
so you mean that I should simply remove that update?
Yup, that's what I would suggest trying. I think it's causing the intent to try to re-setup the Payment Method, which requires mandate information be provided.
ok let me try real quick
there is a way to expand the payment_intent of an invoice?
๐ there's a payment_intent parameter on the invoice
you'd do something like expand: 'invoice.payment_intent'
in create or finalize?
the payment intent only exists after invoice has been finalized
draft invoices won't have a PaymentIntent
ok makes sense ๐
@whole grove was right!
indeed by removing that piece of code that was updating the payment intent it fixes it
what a weird thing tho
Great! glad that worked ๐
so let me rephrase real quick to see if i've understood correctly:
- With manual one-off invoices, there is no need to update the PI to
setup_future_usage, because they will likely being paid on-session. (even if the payment method is indeed setup for off-session by checkout) - With subscriptions instead we need to enable
off-sessionbecause of subsequent subscription updates that will be paid off-session
- Correct
- If you're using SetupIntents prior to creating subscriptions, then you don't need to set
off_sessionreally as the payment method was already setup previously. If you don't have a payment method setup then you can usesave_default_payment_methodunderpayment_settingsparameter
https://stripe.com/docs/api/subscriptions/object#subscription_object-payment_settings-save_default_payment_method
That'd would let you store the payment method on the subscription which then will be charged for subsequent payments.
So overall, you don't need to update the payment intent separately for above to work.
ok I see
it's always a bit confused how this thing works
that's more clear now tho
i need to the one-off because for in another scenario I support i clone payment methods from the platform to the connected account
and they are considered like off-session payments
NP! you can always take a step back and look at our canonical docs for subscription integrations
https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
It has step by step instructions
basically in my integration I'm using setup intents with checkout for all payment methods which are not possible to be cloned
and cloning from platform in any other case
and i do both subscriptions and manual invoices so i need to find the right balance of settings ๐
by the way the issue is solved for now, I don't want to waste any more of your time
thank you @tawny anvil !
have a good rest of the day