【发布时间】:2017-03-24 07:00:38
【问题描述】:
我正在为我的网站使用 angular2 内置的贝宝交易。这是我的贝宝表格的代码。组件函数。
paypalPayment(cartArr) {
var form = document.createElement("form");
form.method = "POST";
form.action = "https://www.sandbox.paypal.com/cgi-bin/webscr";
this.createElement(form, 'charset', 'utf-8');
this.createElement(form, 'cmd', '_xclick');
//this.createElement(form, 'cmd', '_cart');
this.createElement(form, 'upload', '1');
this.createElement(form, 'currency_code', 'USD');
this.createElement(form, 'business', "my_business@mail.com");
this.createElement(form, 'email',"user_email@test.com");
this.createElement(form, 'custom', '{ "order_id": ' + this.order_id + ' }');
this.createElement(form, 'item_name', "Item");
this.createElement(form, 'amount', "10");
this.createElement(form, 'quantity', 1);
this.createElement(form, 'return', 'sitename.com/purchase/close_verified_order/' + this.order_id);
this.createElement(form, 'cancel_return', 'sitename.com/purchase/cancel/' + this.order_id);
this.createElement(form, 'notify_url', 'sitename.com/purchase/close_invalid_order/' + this.order_id);
document.body.appendChild(form);
form.submit();
}
在上面的表格中,当我使用_xclick 时,它会返回transaction id 中的transaction id 等基本详细信息URL,但我需要所有交易详细信息。下面是返回页面的代码。
ngOnInit() {
let transactionId = this.route.snapshot.queryParams['tx'];
this.order_id = this.route.snapshot.params['id'];
}
paypal 如何提供所有交易细节?我已经阅读了IPN,但我不知道如何在angular2 中使用它。
我想知道我应该在notify_url 或return 中进行哪些更改才能获得所有交易详情。 ?
如果贝宝在POST 数据中发送交易详情,那么我该如何在angular2 代码中处理呢?
如果我需要使用 IPN,那么如何从 paypal 获取 auth_token,然后如何从 angular2 调用它的 api?
【问题讨论】:
标签: angular paypal paypal-ipn paypal-sandbox angular2-forms