2017-05-10 8 views
0

私は以下のようにしようとしたRazorPay支払いゲートウェイを使用して、私の支払いトランザクションを完了しようとしている:angular2でのrazorpayの応答を処理する方法は?

var options = { 

    "key": "XXX", 

    "amount": 100, // 2000 paise = INR 20 
    "name": "Ezshipp", 
    "description": this.itemName, 
    "image": "../images/logo-blue-1.png", 
    "handler": function (response) { 
       this.paymentId = response.razorpay_payment_id; 
     console.log("payment id "+this.paymentId); 
     this.orderanything(this.paymentId); 

    }, 

    "prefill": { 
     "name": this.UserName 
    }, 
    "notes": { 
     "address": this.pickAddress 
    }, 
    "theme": { 
     "color": "#12a6f1" 
    } 

}; 

私はこのようなエラーましハンドラ応答内の別のメソッドを呼び出すためにしようとしている:

this.orderanythingは

関数ではありませんが、私は私のコンポーネントでorderanything(paymentId)関数を宣言しました。

答えて

0

ソリューションは

let options:any = { 
// your options 
} 

options.handler = ((response) => { 
this.paymentId=(response.razorpay_payment_id); 
this.orderanything(this.paymentId) 
}); 

あなたの関数(orderanything)を見つけ、

orderanything(paymentId) { 
// define your functioin 
} 
関連する問題