#carlos-offsession-error

1 messages · Page 1 of 1 (latest)

modern berry
stray bolt
#

I'm using the confirmCardPayment component, in it I pass the off_session parameter to use the payment method informed in future payments.

modern berry
#

what's not working, what's the exact error

stray bolt
#

The payment method has been attached but not used for future payments

#

wait

#

i think i found the problem

modern berry
#

ah nice!

stray bolt
#

not working hahah

#

my code

#

is not setting as default payment method. At the time of subscription renewal fails

modern berry
#

I'm sorry you gave a lot of screenshot, what's your real question?

stray bolt
#
async function handleConfirmCardPayment() {
        const { error } = await stripe.confirmCardPayment(clientSecret ?? dadosModal.clientSecret, {
            payment_method: {
                card: elements.getElement(CardElement),
                billing_details: {
                    name: holder,
                },
                metadata: {
                    "origem": "mensalidade"
                }
            },
            setup_future_usage: 'off_session'
        });

        if (error) {
            errorToast(error.message)
            setLoading(false);
        } else {
            setTimeout(() => {
                window.location.reload();
                onClose();
                sucessToast('Pagamento confirmado!');
            }, 5000)
        }
    }
#

this is my code

modern berry
#

sure but again what's the problem?

#

Can you summarize in one sentence the real issue, exact error and clear example request id/object id that is relevant?

stray bolt
#

I'm trying to set a default payment method but off_session I didn't set it, it just attaches the card to the customer

modern berry
#

correct, that's how it always works, you have to set this yourself

stray bolt
#

the off_session parameter is not setting a default payment method for the subscription, it is just attaching to the client

#

what is off_session for then?

modern berry
#

off_session indicates that you plan in the future to re-use the card payment method without the customer being on your app/website where they can't do 3DS

#

So really, it's on you to set the PaymentMethod as the default

stray bolt
#

ok

#

can you send me the documentation on how to set a default payment method?