Amazon Pay

Amazon Pay

Introduction

Amazon Pay can be utilized as a checkout option on a payment page as well as a direct checkout option on the cart page. Loading the Amazon Pay button via COPYandPAY payment widget is just like loading any other brand, i.e. in step 2, AMAZONPAY must be specified as a brand. Once the Amazon Pay button will be used by the consumer, the Amazon Pay payment sheet will appear on the device.

Amazon Pay on the payment page

Loading the Amazon Pay button via COPYandPAY payment widget is just like loading any other brand, i.e. in step 2, AmazonPAY must be specified as a brand.

See an example below.


Amazon Pay on the cart page

Sometimes you might want to display the Amazon Pay button early on the payment workflow where you do not yet have a checkout ID. Usually, the shopper can decide whether to continue with the normal checkout, or to immediately pay with Amazon Pay.

It is possible to display the Amazon Button first and create a checkout ID later. In step 2:

  • Use paymentWidgets.js without a checkout ID
    <script src="https://prosa.prosa.docs.oppwa.com/v1/paymentWidgets.js"></script>
  • Define a callback function in wpwlOptions.createCheckout to create a checkout
We will call the callback function once the Amazon Pay button is clicked. The function will receive one parameter with the used brand ({brand: 'AMAZONPAY'}) and should return a checkout ID. Specifically, the returned object can be any thenable object. In particular, both JavaScript Promise and jQuery Promise are supported.

Example:


    var wpwlOptions = {
	inlineFlow : ["AMAZONPAY"],
	amazonpay:{
	    merchantId : "A2NLZLCXNBPPNB",
	    ledgerCurrency : "USD",
	    sandbox: "true",
	    checkoutLanguage: "en_US",
	    productType: "PayAndShip",
	    placement: "Cart",
	    buttonColor: "Gold"
	},

	createCheckout: function(additionalData) {
	    return $.post("https://your.server",{
		"authentication.entityId": "ff80818176f1e2930176f1f9d6b10004",
		"authentication.password": "ETN6Eh7Y8n",
		"authentication.userId": "ff80818176f1a1bf0176f1ae9ef40005",
		"amount": "2.53",
		"currency": "USD",
		"paymentType": "DB",
		"testMode": "EXTERNAL",
		"cart.items[0].name":"Battery Power Pack",
		"cart.items[0].price":"10.12",
		"cart.items[0].quantity":"1",
		"cart.items[0].tax":"0",
		"cart.items[0].totalAmount":"10.12",
		"cart.items[0].totalTaxAmount":"0",
		"customer.email":"john@doe.com",
		"customer.givenName":"John",
		"customer.surname":"Doe",
		"shipping.street1":"Ship Street 1",
		"shipping.street2":"Ship Street 2",
		"shipping.city":"Ship City",
		"shipping.state":"Ship State",
		"shipping.country":"US",
		"shipping.postcode":"30092",
		"shipping.customer.email":"ship@email.com",
		"shipping.givenName":"John",
		"shipping.surname":"Doe",
		"customer.ip":"127.0.0.1",
		"merchantTransactionId":"fastCheckoutMerTxId",
		"merchantInvoiceId":"fastCheckoutMerInvId"

	    }).then(function(response) {
		return response.id;
	    });
	}
    };    
    
    

Amazon Pay Options

As with other options, you can modify the Amazon Pay behavior by using wpwlOptions.amazonPay. The full reference of all available options is shown below in this page.

References

The following table lists all available Amazon Pay options that you can use with wpwlOptions.amazonPay.

Parameter Description Examples
merchantId Merchant ID as registered in Amazon Seller Central application merchantId: "A2NLZLCXNBPPNB"
ledgerCurrency Ledger currency provided during registration for the givenmerchant identifier. Any one of USD, EUR, GBP, JPY. ledgerCurrency: "USD"
sandbox If true, Sets button to Sandbox environment sandbox: "true"
checkoutLanguage Language used to render the button and text on Amazon Pay hosted pages. Any one of NONE, en_US, en_GB, de_DE, fr_FR, it_IT, es_ES, ja_JP checkoutLanguage: "en_US"
productType This indicates the Product type selected for checkout. Supported values - 'PayAndShip', 'PayOnly' and 'SignIn' productType: "PayAndShip"
placement This indicates the Placement of the Amazon Pay button. Supported values: ‘Home’, ‘Product’, ‘Cart’, ‘Checkout’, and 'Other'. emailRequired: "true"
buttonColor Color of the Amazon Pay button. Supported values: 'Gold', 'LightGray', 'DarkGray' buttonColor: "LightGray"