在Ionic 3中成功从razorpay成功后如何重定向到页面

时间:2019-05-06 09:30:22

标签: android cordova ionic-framework razorpay

我已遵循此instruction在ionic 3中实施Razorpay。面临的问题是交易已成功完成,但成功后应该导航到“谢谢”页面,但向我显示空白页面。

我的.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);
    };
  }

我想念什么? 成功后,将其重定向到空白页。非常感谢您的帮助。 我也尝试过此solution,但不知道如何实现。

0 个答案:

没有答案