【发布时间】:2020-11-16 20:31:58
【问题描述】:
我正在尝试如何在 paypal 中填写送货信息,尤其是客户的电子邮件地址和姓名。
这是我的代码:
paypal.Buttons({
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
reference_id: "PUHF",
description: "Some description",
custom_id: "Something7364",
soft_descriptor: "Great description 1",
amount: {
currency_code: "EUR",
value: "234.00",
breakdown: {
item_total: {
currency_code: "EUR",
value: "200.00"
},
tax_total: {
currency_code: "EUR",
value: "20.00"
},
discount: {
currency_code: "EUR",
value: "5.00"
},
shipping: {
currency_code: "EUR",
value: "20.00"
},
insurance: {
currency_code: "EUR",
value: "1.00"
},
shipping_discount: {
currency_code: "EUR",
value: "2.00"
}
}
},
items: [
{
name: "Item 1",
description: "The best item ever",
sku: "xyz-2654",
unit_amount: {
currency_code: "EUR",
value: "100.00"
},
quantity: "1"
},
{
name: "Item 2",
description: "Not bad too",
sku: "zdc-3942",
unit_amount: {
currency_code: "EUR",
value: "50.00"
},
quantity: "2"
}
],
shipping: {
address: {
name: {
given_name: 'Jean',
surname: 'Martin'
},
email_address: 'jeanmartin[at]email.com',
address_line_1: "218 rue de la liberté",
address_line_2: "",
admin_area_2: "Paris",
admin_area_1: "",
postal_code: "75000",
country_code: "FR",
}
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
// Show a success message to the buyer
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
收货地址填写好,但paypal页面没有填写姓名和电子邮件地址。
有人可以帮我将正确的参数传递给贝宝吗?
【问题讨论】:
标签: javascript paypal