#BilalSaeedAlam
1 messages · Page 1 of 1 (latest)
Hi
Can you share more details please ?
Yes
Basically i am using ACH future payment method so i am storing setup intent id into database.
Now when i need to charge customer i am using these steps:
1- Retrieve setup intent
const setupIntent = await stripe.setupIntents.retrieve(
merchant[0].stripe_setup_intent
);
2- Get payment type
const paymentMethods = await stripe.paymentMethods.list({
customer: setupIntent.customer,
type: "us_bank_account", // us_bank_account
});
3- Charging customer like this with payment intetn
ry {
const paymentIntent = await stripe.paymentIntents.create({
amount: 100,
currency: "usd",
// automatic_payment_methods: { enabled: true },
customer: data[0].customer,
payment_method: data[0].id,
off_session: true,
confirm: true,
receipt_email: customer ? customer.email : "",
description:
"3% of your purchase goes toward our ocean cleanup effort!",
});
Ath the end having this error
The PaymentMethod provided (us_bank_account) is not allowed for this PaymentIntent.
requestId: 'req_zCxepm5fdPZfSE',
Can you add payment_method_types:['us_bank_account'] when creating the PaymentIntent ?
https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method_types
I am adding this parameter
payment_method: data[0].id,
In this data[0].id there is payment method id
yes I saw that... add payment_method_types:['us_bank_account']too
Okay lemme add this
Yep its working now, so can you tell me how to check like with webhooks when payment is successeded or failed
You can listen to this two events:
payment_intent.succeededpayment_intent.payment_failed
You can find all events here:
https://stripe.com/docs/api/events/types#event_types-payment_intent.succeeded
But how to setup all this into my applicaiont, can you please guide me
Check these guides:
https://stripe.com/docs/webhooks
https://stripe.com/docs/webhooks/quickstart
Thank you man