#ahmed99 - payment error
1 messages · Page 1 of 1 (latest)
Where are you seeing an error? Can you share a request or event id I can look at?
https://stripe.com/docs/api/request_ids like req_123 or evt_123 eg
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
req_jbL3cI99bHhi4H
Did you look at the error message?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
You cannot use the test ID 'pm_card_visa' in livemode. If you are testing your integration, please use your testmode API keys instead.
yes
You can't use test payment methods in live mode
What do you expect to happen here? What are you trying to do?
i think i already changed it.. but still nothing going through
You need to review your integration to figure out why you are supplying a test payment method ID in live mode
@broken crow
we have supply the live key
Yes but if you look at the error you are sending a test payment method while using your live key
Instead of real payment details
Can you share the snippet of code you're using to make that request?
the problem is that we already seems we fixed that error but still facing payment failed and there are no more logs provided on the dashboard on stripe logs
So it's very strange and we been trying to troubleshoot this whole day today and still unable to do so
What are you unable to trouble shoot?
Do you have any examples failing where you correctly supply non-test payment info?
export const stripePayment = functions.https.onCall(async (request: any, response: any) => {
const { amount, email, customerId } = request;
try {
functions.logger.info("user information", email);
functions.logger.error('details are ', amount, email, customerId);
var paymentIntent = await stripe.paymentIntents.create({
amount: amount,
currency: 'myr',
receipt_email: email,
// payment_method: 'card',
confirm: true,
customer: customerId,
payment_method_types: ['card']
});
return ({
status: 200,
message: "Payment Successful",
client_secret: paymentIntent.client_secret,
payment_intent: paymentIntent.id,
});
} catch (error) {
functions.logger.error("Error while creating payment intent", error);
return ({
status: 500,
message: `Payment Failed`,
data: error
});
}
});
That code does not match the request you shared -- there is no payment_method specified
what should be the actual payment_method i guess it's optional to provide
It's not optional, no, it needs to be provided as the source of the payment. It looks like you're sending the client secret back to your client. If you're following the recommended guide for client-side confirmation with Stripe.js & Elements, then you should not use confirm when creating the payment intent.
Can you share more about your integration, how you're collecting payment details?
it's from flutter side.. just a sec
await Stripe.instance.dangerouslyUpdateCardDetails(card);
final billingDetails = BillingDetails(
email: user!.email,
name: user.fullName,
phone: user.mobileNumber,
);
await Stripe.instance.createPaymentMethod(PaymentMethodParams.card(
billingDetails: billingDetails,
));
final paymentIntentResult = await callPaymentHook(
amount: amount,
customerId: user.stripeCustomerId,
email: user.email,
);
Ah gotcha
Well I am not seeing any more errors appearing in your account logs ( https://dashboard.stripe.com/test/logs ) so it's possible your payment requests are not being submitted
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
But if you are confirming client side then you should not be confirming when you create the payemtn intent
should i need to add payment_method: confirm..?
No, that's no valid
then what do you suggest/propose to solve this error? @full peak
I suggest reviewing our "accept a payment" guide using React Native as a comparison/analog for flutter to following along the steps to complete this payment
At a high level:
1/ Create a payment intent on the server
2/ Send the client_secret back to the client
3/ Colelct payment details & confirm the payment on the client using the client secret