I have created a customer and payment intent in Stripe with the intention of charging the customer after the payment intent is initially completed. According to this article, all I should have to do is add the customer id to the payment intent and add setup_future_usage : 'off_session',
to the payment intent object. Then I should be able to call the payment intent later and make the charge.
When running a test payment, I can see the future use payment intent in the Stripe dashboard. payment intent future use
But when I call for the customer's payment methods, I get an empty array.
Attempt #1
const paymentMethods = await stripe.paymentMethods.list({
customer: customerId,
type: "card",
});
Attempt #2
const paymentMethods = await stripe.customers.listPaymentMethods(
customerId,
{
type: "card"
},
);
Empty list in response: empty response
The Stripe logs also shows these attempts with the correct customer ID.
I found a solution. I could only get the Payment Method to auto-attach to the customer if I created the Payment Intent with the Stripe customer ID. Previously, my customer ID was added to the Payment Intent with an update.