#saneewhy-PI-error

1 messages ยท Page 1 of 1 (latest)

meager remnant
lime galleon
#

pm_1LGQGG2HIPBIdkNuF9XtQFUb is this it?

meager remnant
#

That's the PaymentMethod ID but it will work

lime galleon
#

Alright

meager remnant
#

Hmmm no actually I'm not seeing that error on your account.

#

Where are you seeing the error specifically?

#

In your terminal?

#

Or client side?

lime galleon
#

In my terminal

meager remnant
#

And that is the full error?

lime galleon
#

Yes

meager remnant
#

Ah you are using Flutter

#

Can you share that PaymentIntent ID that is in the error message

lime galleon
#

sure

meager remnant
#

Or rather, can you post that full screenshot as text

lime galleon
#

{"provider":"STRIPE","user":{"guId":"YM0a26WAbJ"},"payment":{"type":"s_card","nonce":"pi_3LGQJG2HIPBIdkNu11i8XMd0","isSaveCard":false,"paidAmount":"15.00","txnAmount":"15.00","subscriptionAmount":"0.00","oneTimePayment":"15.00"},"itemList":[{"guId":"oYdv7jkG2N","billingDay":0,"noOfBillingCycles":0,"txnAmount":"15.00","subscriptionAmount":"0.0","finalSubscriptionAmount":"0.00","oneTimePayment":"15.00","finalOneTimePayment":"15.00","membershipExpEpoch":"1659112424"}]}
I/flutter (17983): {"error":{"message":"Method Id already used"}}

#

here

meager remnant
#

Huh that PaymentIntent mentioned was successful.

#

Where in your code is this error getting thrown?

lime galleon
lime galleon
meager remnant
#

Can you share your code

lime galleon
#

var paymentMethod = await createPaymentMethod(
cardDetails.number!,
cardDetails.expirationMonth.toString(),
cardDetails.expirationYear.toString(),
cardDetails.cvc.toString());
if (paymentMethod.statusCode == 201 || paymentMethod.statusCode == 200) {
var paymentMethodResponse = jsonDecode(paymentMethod.body);
if (paymentMethodResponse['id'] != null) {
var intent = await paymentIntent(total.value.toInt() * 100);
if (intent.statusCode == 201 || intent.statusCode == 200) {
var paymentIntentResponse = jsonDecode(intent.body);
if (paymentIntentResponse['secret'] != null) {
if (paymentIntentResponse['id'] != null) {
var id = paymentIntentResponse['id'];
var methodId = paymentMethodResponse['id'];
var confirm = await confirmPayment(id, methodId);
if (confirm.statusCode == 201 || confirm.statusCode == 200) {
var responseBody = jsonDecode(confirm.body);
if (responseBody['id'] != null) {
var temp = await getItemInvoiceStripe(
item, responseBody['id'] ?? '', offerCode.value.id ?? "");
promoLoading.value = false;
if (temp.guId != null && temp.guId!.isNotEmpty) {
Get.back();
Get.back();
Get.off(() => const SuccessFulPayment());
}
} else {
promoLoading.value = false;
showToast("Unable to find Client's Id");
}
} else {
promoLoading.value = false;
showToast("Something went wrong!!");
}
}
}
}
}

#

This is my payment function

#

Is checkout call mandatory after every transaction?

#

Because I haven't included it yet

#

Is that what might be causing the error?

meager remnant
#

What do you mean by "checkout call"?

#

You mean confirmPayment()?

#

Ah okay

#

So the error you are seeing is based on the PaymentMethod

#

Since you are setting the PaymentMethod as methodId

oblique silo
#

Hi ๐Ÿ‘‹ I'm stepping as @meager remnant needs to step away

#

The start of your question is about confirming a payment intent, you shouldn't need to do anything related to Checkout Sessions. That is an entirely different process.

#

Can you share the documentation for the flow you are following?

#

For example

lime galleon
oblique silo
#

The doc you linked is just an API reference doc. I'm trying to understand your overall process flow.

#

Could you describe, overall, what you are trying to accomplish and where you are running into problems.

lime galleon
#

Okay so I'm trying to integrate stripe with the payment process in my mobile application using flutter

lime galleon
# lime galleon

I've used all the apis and the transaction is successful but stripe is showing the above error at the end of every transaction

oblique silo
#

So all API requests are successful?

lime galleon
oblique silo
#

That link is not something I can examine

lime galleon
#

req_dN7IETUJEsu9rC

oblique silo
#

Thank you! Looking now

#

That is a GET request. All this does is retrieve the Payment Intent.

lime galleon
#

req_dPJjTOxssgPDPB

#

how about this one?

oblique silo
#

Great, thanks

#

This looks like a successful PI confirmation. What part of this app is failing?

lime galleon
#

There's a toast message that says "methodId already used" and the same is displayed in the terminal

lime galleon
oblique silo
#

The payment confirmation has succeeded. The charge has been made. Report success to your user.

#

The Payment Intent that is returned from this API call includes the status of succeeded. You can use this to indicate to your user that their payment was successful.

lime galleon
#

Okay