How to redirect to page after success from razorpa

2019-08-20 14:32发布

I have followed this instruction for implementing Razorpay in ionic 3. The problem im facing is that the transaction are being made successfully but after success it should navigate to thankyou page but its showing me blank page.

My .ts

pay() {
        description: 'Credits towards consultation',
        image: 'https://i.imgur.com/3g7nmJC.png',
        currency: 'INR',
        key: 'rzp_test_1DP5mmOlF5G5ag',
        amount: '5000',
        name: 'foo',
        prefill: {
                email: 'pranav@razorpay.com',
              contact: '8879524924',
                 name: 'Pranav Gupta'
                },
        theme: {
              color: '#F37254'
               }
        },
        modal: {
        ondismiss: () => {
          alert('Cancelled')
        }
      }
    };

    var successCallback = (success) => {

      this.navCtrl.push(FinishPage, {
        'payment_id': success.razorpay_payment_id
      });
    }

    var cancelCallback = (error) => {
      alert(error.description + ' (Error ' + error.code + ')');
    };

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


    document.addEventListener('resume', onResume, false);
    var onResume = function (event) {
      // Re-register the payment success and cancel callbacks
      RazorpayCheckout.on('payment.success', successCallback)
      RazorpayCheckout.on('payment.cancel', cancelCallback)
      // Pass on the event to RazorpayCheckout
      RazorpayCheckout.onResume(event);
    };
  }

What am i missing? After success its redirecting to a Blank page. Any Help is highly appreciated. Also I tried this solution but couldn't figure out how to implement this.

0条回答
登录 后发表回答