Fundraising tech/Amazon Pay
Donation Interface Amazon Pay IntegrationEdit
The first script redirects the donor to amazon.com to log in to their Amazon account, and that login page then redirects the donor back to payments-wiki with some special URL parameters.
The second script uses those URL parameters to create an iframe in the payments-wiki form showing a list of payment methods the donor has connected to their Amazon account. They can select one of those methods and click 'Donate', or they can click a button to add a new payment method, select it and click 'Donate'. If they choose to add a new payment method, that is done in a new window hosted at amazon.com, not in a window hosted by us.
When the donor clicks 'Donate', the browser makes an AJAX request to payments-wiki with an order ID generated by the wallet widget. Payments-wiki uses that order ID and some secret credentials to make Amazon Pay API calls to authorize and capture the payment.
Here's some more technical info on the integration Since we only source the Amazon script on a page where we know the donor wants to use Amazon, we don't follow this guide exactly - instead of adding a button we just set the login parameters and execute the amazon.Login.authorize function to redirect the user to sign in at Amazon: https://developer.amazon.com/docs/amazon-pay-onetime/add-a-button.html Then on the donor's return, we add only the wallet widget as described here: https://developer.amazon.com/docs/amazon-pay-onetime/add-widgets.html