#MrGrygson

1 messages · Page 1 of 1 (latest)

upbeat basinBOT
shrewd oxide
#

it depends if the customer is paying for something at the same time as they are saving the card, or if they're purely on your web page just to save the card and you'll charge them later(hours/days later)

hushed monolith
#

In general, they should also pay at the same time

shrewd oxide
hushed monolith
#

So, I've configured code like on setup for future payments, just without checkout session, but using attach method as described in point 5 on this page.
My problem is that for running for some time, I got 2 errors while calling attach to payment method: card_declined, which means that the method that was just created cannot be used.

#
// Create the PaymentMethod using the details collected by the Payment Element
        const { error, paymentMethod } = await stripe.createPaymentMethod({
            elements,
            // params: {
            //     billing_details: {
            //         name: "Jenny Rosen",
            //     },
            // },
        });

        if (error) {
            // This point is only reached if there's an immediate error when
            // creating the PaymentMethod. Show the error to your customer (for example, payment details incomplete)
            handleError(error);
            return;
        }

        // Store new payment method
        await store.storePaymentMethod("STRIPE", paymentMethod);
shrewd oxide
#

generally you would never call the direct attach API

#

what exact guide are you using, what is this point 5?

hushed monolith
shrewd oxide
#

ah.

#

so you don't pass a Customer ID when creating the Session?

hushed monolith
#

I'm not creating session

shrewd oxide
#

ah duh

#

then I don't really understand you. At no point would you manually attach the PaymentMethod. You confirm the SetupIntent, and that action automatically attaches the PaymentMethod to the Customer associated with the SetupIntent for you, that's it.

hushed monolith
#

So setup intent will just add the payment method to given customer, and confirming it will do the autorization, but wont capture the money yet, right?

#

I just want to add a payment method, don't want to capture the money in the same step