I have a flow where i'm unable to charge the full payment via off-session payments and its being rejected from banks with Failure code: card_declinedand network_decline_code: 59.
Customer buys a product via checkout. Checkout link is generated with. payment_intent_data.setup_future_usage: off_session.
After the payment is confirmed i consume event payment_intent.succeeded and using this i save the customer_id and payment_method on my end. So that i can change the full payment after X days.
AfterX days, a payment_intent is created with the full_amount , with the same payment_method and customer_id saved after receiving payment_intent.succeeded with off_session: true , confirm: true.
But all of my payments are being rejected with the above Failure code and network_decline_code.
Below you can find my code used for checkout and off-session payment intent.
If you can suggest an alternative way?
// Checkout
await stripeClient.checkout.sessions.create({
success_url:successUrl,
mode:'payment',
line_items:line_items,
payment_method_types:['card'],
customer_creation:'always',
payment_intent_data:{
setup_future_usage:'off_session',
metadata:{
phase:"checkout_initial",
},
},
allow_promotion_codes:true,
currency:currency,
billing_address_collection:'required',
shipping_address_collection:{
allowed_countries:['US']
},
phone_number_collection:{
enabled:true,
},
invoice_creation:{
enabled:true
}
})
// payment intent
await stripeClient.paymentIntents.create({
amount: amountPending,
currency: currency,
customer: stripeCustomerId,
payment_method: stripePaymentMethodId,
off_session: true,
confirm: true,
metadata: {
phase: 'full_charge'
}
});
Top comments (0)