#asdfghi-save_and_reuse
1 messages · Page 1 of 1 (latest)
hi there! can you share more on what you're comparing to? i.e. you say that on server site for creating charges should I create another route or same rout we can use? - what's the same route which you're referring to?
after 2 days I am running this server
Charge is not happening.
Am I missing anything here?
you're missing the payment method. You can refer to this section : https://stripe.com/docs/payments/save-and-reuse#charge-saved-payment-method
can you share the request id? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Would this help? req_bkzj5dYG6kEgaX
i'm not seeing any errors from the request itself. Which line of your code is throwing an error?
If I look at the requests made to Stripe in your Dashboard logs [0] , I'm only seeing requests to create SetupIntents.
There're no requests to create a PaymentIntent. I'm guessing that your application never makes the request to the route that creates a PaymentIntent.
You're going to need to walk through your application code step by step to verify where it's making the request to create a PaymentIntent / where the issue is
I am now saving the card from the client app.
As I want to charge later which is after 2days. How should I write the server?
ah okay, sorry, i forgot that you wanted to charge after 2 days. You need to implement your server logic to create the PaymentIntent after 2 days. How you do that is entirely up to you e.g. you may want to run a cron job to run at a certain time or at intervals once a day
Thanks! which stripe APIs that I should call in side the program?
app.post('/payNow', async (req, res) => {
try {
const paymentMethods = await stripe.paymentMethods.list({
customer: customer.id,
type: 'card',
});
const paymentIntent = await stripe.paymentIntents.create({
amount: 8000,
description: 'professor react-native',
payment_method_types: ['card'],
currency: 'inr',
customer: customer.id,
off_session: true,
confirm: true,
});
} catch (err) {
// Error code will be authentication_required if authentication is needed
console.log('Error code is: ', err.code);
}
});
this is my current server app. But I dont think it is correct at all
a cron job isn't related to Stripe APIs, you may want to search online for how to implement cron jobs
but with regards to your code - it's still missing the payment_method parameter : https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
Hi @fickle gull I'm taking over this thread, let me know if you have any questions