razorpay / razorpay-capacitor

Capacitor wrapper around Razorpay's Android and iOS SDKs
https://www.npmjs.com/package/com.razorpay.capacitor
12 stars 28 forks source link

success response not received after first payment fails. #58

Open hiteshrsdigitech opened 1 year ago

hiteshrsdigitech commented 1 year ago

if the payment is successful on the first try, The resolve function passed in the .then is called. but if the payment fails and the user retries payment and if it succeeded then resolve function is not getting called.

Below is my function.

import { Checkout } from 'capacitor-razorpay';

async payWithRazorpay() {
    try {
      const options = {
        key: 'rzp_test_123',
        amount: 10000,
        description: 'Deposit',
        order_id: 'order_123',
        currency: 'INR',
        prefill: {
          email: 'abc@gmail.com',
          contact: '9999999999'
        },
        notes: {
          payment_id: 123
        }
      };
      const {response}: any = (await Checkout.open(options));
      console.log(response);
    } catch (error) {
      console.log(error);
    }
  }

If payment success on the first attempt, then the code is working fine. I am getting a response.

But in first attempt fail and second attempt success then there is an issue.

Below is flow

First I select payment method image

then i got redirected to payment page i click on failure image

then below screen displayed image

Now I click on the try again button and then select payment gateway and then select success. Now I cannot get response in success case in my function.

How can I resolve this issue?

Thank you.

mukul-myhq commented 6 months ago

Hi @vivekshindhe, Facing the same issue, any fix for the same? Adding my project's plugin version for ref. @capacitor/cli: 5.7.0 Ionic CLI: 7.2.0 @angular/cli: 15.2.10 capacitor-razorpay: 1.2.0

vivekshindhe commented 6 months ago

@mukul-myhq I just tested this out on my end. Unable to reproduce this. Are the steps with which you are able to reproduce the issue the same as @hiteshrsdigitech? If not can you post the steps here? Also please post the code snippet of the payload and the instantiation of Checkout.

mukul-myhq commented 6 months ago

Hi @vivekshindhe , thanks for your quick reply, It's the same steps as listed by @hiteshrsdigitech . The issue is that on the FE I'm only getting the first failure response, and Razorpay does not give me any info regarding the next set of failures/successes. Even though on the BE payment is captured successfully (last payment state), the state on FE becomes incorrect (leaving no easy way for us to show the appropriate state). Lmk if any further assistance is needed. Thanks!

vivekshindhe commented 6 months ago

@mukul-myhq would request you to create a support ticket at your Razorpay Dashboard. Since we aren't able to reproduce the issue, a ticket will allow us to monitor and handle the issue much more closely with easier back and forth. You can mention this GitHub issue when you create the ticket. This will also help in fairly quick turnaround time.

dksanket commented 4 months ago

May I know if this is fixed? I am also facing the same issue.