#biswa-flutter-india
1 messages · Page 1 of 1 (latest)
Quick question: Are you using flutter_stripe (https://pub.dev/packages/flutter_stripe) or are you doing your own Stirpe.js implementation with flutter?
i am using flutter stripe
That is actually a third party library so we are less knowledgable about working with it. If you are writing your own Stripe.js code can you send me what code you currently have that is trying to handle this error?
is stripe provides a flutter libary>
router.post("/stripeInitiate", async function(req,res){
console.log(req.body);
try {
let customerId;
//Gets the customer who's email id matches the one sent by the client
const customerList = await stripe.customers.list({
email: req.body.email,
limit: 1
});
console.log(customerList.data[0]);
//Checks the if the customer exists, if not creates a new customer
if (customerList.data.length !== 0) {
customerId = customerList.data[0].id;
}
else {
const customer = await stripe.customers.create({
name: req.body.name,
email: req.body.email,
address: {
line1: '510 Townsend St',
postal_code: '98140',
city: 'San Francisco',
state: 'CA',
country: 'US',
},
});
customerId = customer.data.id;
}
//Creates a temporary secret key linked with the customer
const ephemeralKey = await stripe.ephemeralKeys.create(
{ customer: customerId },
{ apiVersion: '2022-11-15' }
);
//Creates a new payment intent with amount passed in from the client
const paymentIntent = await stripe.paymentIntents.create({
amount: parseInt(req.body.amount),
currency: req.body.currency,
metadata : req.body.metadata,
customer: customerId,
automatic_payment_methods: {enabled: true},
description: 'Software development services',
})
console.log(paymentIntent)
res.status(200).send({
paymentIntent: paymentIntent.client_secret,
ephemeralKey: ephemeralKey.secret,
customer: customerId,
success: true,
})
} catch (error) {
res.status(404).send({ success: false})
}
});
This helps or should is send anything else
Oh, I see. So requires_payment_method is actually the default state for payment intents https://stripe.com/docs/payments/intents
So it is expected here because you are creating the intent without passing a pre-saved payment method ID in to the create call
So this isn't an error and your front end code should be able to provide the payment method in some way
but i am the displaymentsheet collect the card details
i mean display payment sheet collects the card data
and there is a pay button to
Are you putting in the card details and submitting the payment?
yes
Is the status staying requires_payment_method after you have submitted the card details?
Right, that is expected. The payment intent's status won't move forward until you fill out all of those card details and submit them for payment
We have a list of test cards if you need example numbers for test mode https://stripe.com/docs/testing
I filled out all the details with test data
Did you hit continue and fully submit the payment?
yes
Hi, stepping in here and catching up.
@golden wedge no one on my team has ever used Flutter and we don't maintain that library so there isn't much we can do to help debug the issues if you don't have detailed information about what's blocking you exactly
you're an IN-based merchant right now and aren't meeting the requirements so you get an error on confirmation
read https://stripe.com/docs/india-exports carefully and make sure to do the required fixes
biswa-flutter-india
you can see this error straight in the Dashboard if you look
"id": "pi_3Mm1VmSED2Z7drmP0TzLX30n",
"object": "payment_intent",
"last_payment_error": {
"message": "As per Indian regulations, export transactions require a customer name and address. More info here: https://stripe.com/docs/india-exports",
"payment_method": {```
Okay let me try