How to redirect to page after success from razorpay in Ionic 3

ぐ巨炮叔叔 提交于 2019-12-11 14:20:02

问题


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.

来源:https://stackoverflow.com/questions/56002415/how-to-redirect-to-page-after-success-from-razorpay-in-ionic-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!