Comments (4)
In the SetPaymentDetails.php file in the OneTimePayments example, you can remove the block of code including and between the lines:
new OffAmazonPayments.Widgets.AddressBook({
....
}).bind("addressBookWidgetDiv");
You can also remove this line:
<div id="addressBookWidgetDiv" style="width:400px; height:240px; display:inline-block;"></div>
That will remove the widget from your screen. You may need to do some additional code on the backend to remove references to shipping address, including no longer needing to pass the AddressConsentToken (or AccessToken) to the backend.
Try these things and let us know if you have any questions.
from amazon-pay-sdk-samples.
You want to remove all these lines of code:
new OffAmazonPayments.Widgets.AddressBook({
sellerId: "xxx",
onOrderReferenceCreate: function (orderReference) {
/* make a call to the back-end that will set order reference details
* and get order reference details. This will set the order total
* to 19.95 and return order reference details.
*
* Get the AddressConsentToken to be sent to the API call
*/
var access_token = "";
$.post("Apicalls/GetDetails.php", {
orderReferenceId: orderReference.getAmazonOrderReferenceId(),
addressConsentToken: access_token,
}).done(function (data) {
$("#get_details_response").html(data);
});
},
onAddressSelect: function (orderReference) {
},
design: {
designMode: 'responsive'
},
onError: function (error) {
// your error handling code
}
}).bind("addressBookWidgetDiv");
So the $.post("Apicalls/GetDetails.php", {
is also removed and then nothing works anymore.
There are so many problems here. Why is nobody here who can support people who want to implement amazon pay?
from amazon-pay-sdk-samples.
OK, I looked into and see my omission.
The onOrderReferenceCreate callback needs to be moved to the Wallet Widget, i.e., so this part:
onOrderReferenceCreate: function (orderReference) {
/* make a call to the back-end that will set order reference details
* and get order reference details. This will set the order total
* to 19.95 and return order reference details.
*
* Get the AddressConsentToken to be sent to the API call
*/
var access_token = "";
$.post("Apicalls/GetDetails.php", {
orderReferenceId: orderReference.getAmazonOrderReferenceId(),
addressConsentToken: access_token,
}).done(function (data) {
$("#get_details_response").html(data);
});
},
Needs to be inserted after the lines
new OffAmazonPayments.Widgets.Wallet({
sellerId: "SELLER_ID",
You only want to have one widget that uses the onOrderReferenceCreate callback, and since we removed the AddressBook widget, we need to move it to the Wallet widget.
Sorry for not mentioning that originally.
There are some other optimizations you can do for digital only goods, such as removing the payments:shipping_address portion of the scope from the index.html file.
from amazon-pay-sdk-samples.
Thank you. I have already find that out by myself.
from amazon-pay-sdk-samples.
Related Issues (20)
- Remove all unnecessary JavaScript and use PHP instead of it HOT 3
- CSharp example has issue HOT 1
- login window not appearing in popup (despite being set to true) HOT 4
- Python: incorrect `redirect_url`? HOT 1
- Java: Missing closing curly brace in OneTimePayments/Widgets.js, line 132 HOT 1
- C# Sample doesn't show live responses HOT 1
- Button and other widgets for React HOT 3
- Transactions from made from a billing agreement should return the billing agreement id HOT 2
- Login with Amazon callback/event if popup is closed HOT 4
- Wallet Widget error: InvalidOrderReferenceId - The OrderReferenceID is invalid. HOT 1
- Amazon Pay Strong Customer Authentication (SCA) Upgrade HOT 9
- Update Fork Link
- Can not callback when clicked the consent widgets ( throw error 400 bad request ) in PHP example recurring payment HOT 8
- devlop code in android
- The Wallet widget should use the Address Book's order reference Id HOT 2
- Amazon Pay Strong Customer Authentication (SCA) example code for PHP
- Python -recurring payment - Access to OffAmazonPayments_Sandbox.ConfirmBillingAgreement is denied
- Recurring payment frequency
- Seller Details not provided HOT 3
- Error handling code HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amazon-pay-sdk-samples.