我想使用php将Amazon pay集成到我的网站中。我想知道在选择付款地址和付款方式后,我可以在脚本中添加哪些代码以呈现客户付款方式。
<script type='text/javascript'>
window.onAmazonLoginReady = function () {
amazon.Login.setClientId('xxxxxx');
};
</script>
<script type="text/javascript" src='https://static-eu.payments-
amazon.com/OffAmazonPayments/eur/sandbox/lpa/js/Widgets.js'>
</script>
<script type="text/javascript">
new OffAmazonPayments.Widgets.AddressBook({
sellerId: 'xxxxxxxx',
scope: 'profile payments:widget payments:billing_address payments:shipping_address',
onOrderReferenceCreate: function (orderReference) {
var orderReferenceId = orderReference.getAmazonOrderReferenceId();
document.cookie= 'reference=' +orderReferenceId;
document.getElementById('orderReferenceId').value = orderReferenceId;
var el;
if ((el = document.getElementById("orderReferenceId"))) {
el.value = orderReferenceId;
}
},
onAddressSelect: function () {
// do stuff here like recalculate tax and/or shipping
},
design: {
designMode: 'responsive'
},
onError: function (error) {
// your error handling code
}
}).bind("addressBookWidgetDiv");
</script>
<script>
new OffAmazonPayments.Widgets.Wallet({
sellerId: 'xxxxxxx',
scope: 'profile payments:widget payments:billing_address
payments:shipping_address',
onPaymentSelect: function () {
alert ("enter");
},
design: {
designMode: 'responsive'
},
onError: function (error) {
// your error handling code
}
}).bind("walletWidgetDiv");
</script>