#BilalSaeedAlam

1 messages · Page 1 of 1 (latest)

karmic novaBOT
tropic narwhal
#

hi, what's the exact question?

digital seal
#

The thing is i am using ACH and CARD future payment functionality. Now at the end on the backend side i need to charge customer and i am using this function to charge :

const paymentIntent = await stripe.paymentIntents.create({
amount: 1,
currency: "usd",
automatic_payment_methods: { enabled: true },
customer: data[0].customer,
payment_method: data[0].id,
off_session: true,
confirm: true,
});
But the thing is i am getting error which is
You must provide a return_url when confirming using automatic_payment_methods[enabled]=true

And the req_*** id is req_e3CahVmNTHrSI6

tropic narwhal
#

well if you already have chosen the exact PaymentMethod object to use and are charging it, there's no need to pass automatic_payment_methods at all.

digital seal
#

1- In first step i am using this function to retrive setup intent
const setupIntent = await stripe.setupIntents.retrieve(
merchant[0].stripe_setup_intent
);
2- Getting payment type with this fuinction
const paymentMethods = await stripe.paymentMethods.list({
customer: setupIntent.customer,
type: "card", // us_bank_account
});

and then call the above function

#

Alright so i don't need to use this

#

I am passing 1 dollor usd but having this error:

CODE:
const paymentIntent = await stripe.paymentIntents.create({
amount: 1,
currency: "usd",
// automatic_payment_methods: { enabled: true },
customer: data[0].customer,
payment_method: data[0].id,
off_session: true,
confirm: true,
});

ERROR: Amount must be at least $0.50 usd

tropic narwhal
#

that is not 1 dollar

#

that is 1 cent

digital seal
#

oops

tropic narwhal
#

1 dollar is amount:100

digital seal
#

Alright, got your point

tropic narwhal
#

5 dollars and 42 cents is amount:542

digital seal
#

Okay

#

I got this Object after charging customer, so can you suggest me which one is the parameter that i can store into data for future refrence

{
id: 'pi_3NGf4kJIXd7Tyawp1QrFX5Mf',
object: 'payment_intent',
amount: 100,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 100,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
client_secret: 'pi_3NGf4kJIXd7Tyawp1QrFX5Mf_secret_nVSfFFdkCo5ekaSVxwLSsClZN',
confirmation_method: 'automatic',
created: 1686216254,
currency: 'usd',
customer: 'cus_O08vi5vdgirVPd',
description: null,
invoice: null,
last_payment_error: null,
latest_charge: 'ch_3NGf4kJIXd7Tyawp1VNeOoZa',
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: 'pm_1NGQLCJIXd7TyawpW03dHrOr',
payment_method_options: {
card: {
installments: null,
mandate_options: null,
network: null,
request_three_d_secure: 'automatic'
}
},
payment_method_types: [ 'card' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: null,
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'succeeded',
transfer_data: null,
transfer_group: null
}

tropic narwhal
#

I don't understand the question.

digital seal
#

Okay lemme explain again.

#

When i will charge through card payment and in response i will get success object

#

So in this object what will be the secure parameter that can be stored into databse for future reference

#

Will it be id: 'pi_3NGf4kJIXd7Tyawp1QrFX5Mf' or something else

tropic narwhal
#

you can store the id of the PaymentIntent if you want to store some ID to be able to lookup the payment later in Stripe's API, sure.

digital seal
#

Alright thank you, and it is possible by charging amount i will automatically generate invoice

tropic narwhal
#

depends. A receipt is generated and sent automatically. Maybe that's enough?