#rahulraval - checkout payments
1 messages · Page 1 of 1 (latest)
Hey there @hard dirge -- to save a payment method for future use during a Checkout payment, you need to set setup_future_usage .
This doc shows how that's done with payment intents directly: https://stripe.com/docs/payments/save-during-payment?platform=web#web-create-payment-intent
With Checkout, you supply this via the payment_intent_data[setup_future_usage] parameter:
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_intent_data-setup_future_usage
I tried passing setup_future_usage: 'off_session' but it didn't store the card
{
success_url: `${SiteBaseURL}/order-confirmation/success?id=${orderId}`,
cancel_url: `${SiteBaseURL}/order-confirmation/error?id=${orderId}`,
client_reference_id: orderId,
customer: customerStripeId,
line_items: [
{
price_data: {
currency: 'usd',
unit_amount: amountToCharge,
product_data: {
name: `Order ${orderId}`,
},
},
quantity: 1,
},
],
// payment_method_types: ['card'],
mode: 'payment',
payment_intent_data: {
capture_method: 'manual',
description: `Bigcommerce Order #${orderId} payment for ${customerEmail}`,
setup_future_usage: 'off_session'
},
this is payload I'm using
OK so it looks like you're alreayd using setup_future_usage: 'off_session' then
Can you explain what is not working like you expect?
wait I tried again, it went fine. Doing couple of more testing.
nvm, it works fine now. thanks @hardy drum !
Great, NP!