Search code examples
ionic4razorpay

Razorpay Integration with Ionic 4 getting Bad request error


I have used razorpay-cordova plugin to perform payment for Rozar pay but I am getting Bad request "The id provided does not exist". But I am using my test key id and that is very correct.

payWithRozarPay(invoice: any) {
    const options = {
      description:
        'Buy ' + invoice.coin_amount + ' amount credit for quicklegalsolutions',
      currency: 'INR',
      key: 'rzp_test_Qtzsbri8xV2oIa',
      order_id: invoice.inv_code,
      amount: invoice.amount * 100,
      name: 'Quick Legal Solutions',
      prefill: {
        email: invoice.user.email,
        contact: invoice.user.mobile,
        name: invoice.user.name
      },
      theme: {
        color: '#F37254'
      }
    };
    console.log(options);
    // tslint:disable-next-line: only-arrow-functions
    const successCallback = function(success: any) {
      alert('payment_id: ' + success.razorpay_payment_id);
      console.log('payment_id: ' + success.razorpay_payment_id);
    };

    // tslint:disable-next-line: only-arrow-functions
    const cancelCallback = function(error: any) {
      alert(error.description + ' (Error ' + error.code + ')');
      console.log(error);
    };

    RazorpayCheckout.on('payment.success', successCallback);
    RazorpayCheckout.on('payment.cancel', cancelCallback);
    RazorpayCheckout.open(options);
  }

Solution

  • remove the 'order_id: invoice.inv_code' from description