无法在payumoney上发布/失败付款后

时间:2017-10-05 06:34:39

标签: angularjs payumoney

我使用payumoney进行使用角度2的付款集成。我有一个组件创建动态表单,用于将数据发布到payumoney。如下所示

export class CheckoutComponent {

model: any = {};
constructor(private _checkoutService: checkoutservice,
    private alertService: AlertService,
    private router: Router, private http: Http) {

}
checkout() {

    this._checkoutService.postdata(this.model)
        .subscribe(
        data => {
            if (data != null) {
                let options = {
                    "firstname": data.firstname,
                    "amount": data.amount,
                    "productinfo": data.product,
                    "email": data.email,
                    "phone": data.phone,
                    "key": data.key,
                    "txnid": data.txnid,
                    "hash": data.hash,
                    "surl": "http://localhost:3000/success",
                    "furl": "http://localhost:3000/failure",
                    "service_provider": "payu_paisa"
                };

                this.post("https://test.payu.in/_payment", options, "post"); 
            }
        },
        error => {
            this.alertService.error(error);
        });
}

post(path: string, params: any, method: string) {
    var form = document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", path);
    for (var key in params) {
        if (params.hasOwnProperty(key)) {
            var hiddenField = document.createElement("input");
            hiddenField.setAttribute("type", "hidden");
            hiddenField.setAttribute("name", key);
            hiddenField.setAttribute("value", params[key]);
            form.appendChild(hiddenField);
        }
    }
    document.body.appendChild(form);
    form.submit();
}

}

但是当付款失败并且payumoney重定向到angular url http://localhost:3000/failure时,它会发出无法发布/失败错误。我被困在这里。我想得到payumoney的回复。感谢任何有关此事的帮助。

1 个答案:

答案 0 :(得分:0)

Angular无法处理POST方法请求。使用后端处理POST请求并重定向到相应的路由。