Amazon Pay


Amazon Pay is a service that lets your customers use the payment methods already associated with their Amazon account to make payments for goods or services. To make a payment, they can use any of the payment methods on file in their Amazon account.

Summary

The necessary operations to integrate Amazon Pay are:

Sign in on Amazon Pay

To use Amazon Pay you must register and follow the instructions.

Then, you have to retrieve a clientID by creating an Application.


Configure Amazon Pay

To communicate with Gestpay sandbox and production environments, You need to set some parameters in the Amazon Pay profile.


In the IPN Configuration you must set these fields:

Sandbox  
merchant URL If you want to receive notifications directly from Amazon, here you can set a personalized URL
integrator URL https://sandbox.gestpay.net/pagam/AmazonPayNotification.aspx
Production  
merchant URL If you want to receive notifications directly from Amazon, here you can set a personalized URL
integrator URL https://ecomm.sella.it/pagam/AmazonPayNotification.aspx

In Login with Amazon > Web Settings section insert the follwing values:


Sandbox  
Allowed Javascript Origins https://sandbox.gestpay.net
Allowed Return URLs https://sandbox.gestpay.net/pagam/AmazonPay.aspx
Production  
Allowed Javascript Origins https://ecomm.sella.it
Allowed Return URLs https://ecomm.sella.it/pagam/AmazonPay.aspx

Gestpay Configuration

In Gestpay backoffice, insert Amazon Pay credentials received when signedd in:


The Show Address Widget checkbox allows the selection of the address from Amazon Pay during the payment by showing the widget; This setting can be disabled if the merchant sells non-shippable items (e.g. non physical goods).

Amazon Pay payment flow

To use Amazon Pay:

1. Encrypt

The first step is to encrypt the payment request and send it to Gestpay. To do this, you’ll call Encrypt in WsCryptDecrypt webservice.

An Encrypt example is available in our API section.

If you want to use the paymentType tag for this method, the value to use is AMAZONPAY. See the section How to redirect the customer to a payment method to learn how to use the paymentType tag.

With Amazon Pay the ShopTransactionId must be unique.

2. Redirect the user

Gestpay will answer to your request with an EncryptResponse, that will contain a field CryptDecryptString.

For test environment, redirect the user to

http://sandbox.gestpay.net/pagam/pagam.aspx?a=<ShopLogin>&b=<CryptDecryptString>

For production environment, the url is

http://ecomm.sella.it/pagam/pagam.aspx?a=<ShopLogin>&b=<CryptDecryptString>

More info on this can be found in Using gestpay payment page.

Once the buyer is redirected, and if he is not authenticated, Amazon will show a login form:


Once the buyer is logged, he will see a page where he can choose the shipping address from Amazon saved addresses:


Then he can choose a credit card amongst the saved amazon credit cards.


At the end, Gestpay will perform an authorization request on the selected credit card, and the buyer will be redirected to the merchant website (positive or negative response URL).

3. Read response from Gestpay

After the payment has been acknowledged, Gestpay will

This process is described in the docs for the payment page, step 3.

The payload of this call are two query parameters, the first being the shopLogin and the second being a encrypted string.

To decrypt the encrypted string you must call Decrypt in WsCryptDecrypt webservice; in the response you’ll see the transaction result.

4. Get the buyer’ shipping and billing address

To retrieve the buyer’s shipping addresses, you call callReadTrxS2S in WsS2S webservice. There, you’ll find also a response example.

The relevant data is contained in the OrderReferenceDetails tag; here we’ll report an example of the response relevant data:

<callReadTrxS2SResponse xmlns="https://ecomms2s.sella.it/">
  <callReadTrxS2SResult>
    <GestPayS2S xmlns="">
        ...
        <OrderReferenceDetails>
          <OrderReferenceStatus>
              <State>Draft</State>
          </OrderReferenceStatus>
          <OrderLanguage>it-IT</OrderLanguage>
          <Destination>
              <DestinationType>Physical</DestinationType>
              <PhysicalDestination>
                <StateOrRegion>BI</StateOrRegion>
                <Phone>33333333</Phone>
                <City>BIELLA</City>
                <CountryCode>IT</CountryCode>
                <PostalCode>13900</PostalCode>
                <Name>Marco Rossi</Name>
                <AddressLine1>via Gobe 15</AddressLine1>
              </PhysicalDestination>
          </Destination>
          <ExpirationTimestamp>2018-05-13T07:24:02.186Z</ExpirationTimestamp>
          <IdList/>
          <SellerOrderAttributes>
              <SellerOrderId>4354395804398dkfjlhsdfk</SellerOrderId>
          </SellerOrderAttributes>
          <OrderTotal>
              <CurrencyCode>EUR</CurrencyCode>
              <Amount>10.00</Amount>
          </OrderTotal>
          <Buyer>
              <Name>Ale</Name>
              <Email>marco.rossi@email.it</Email>
          </Buyer>
          <ReleaseEnvironment>Sandbox</ReleaseEnvironment>
          <AmazonOrderReferenceId>S02-0319513-4657042</AmazonOrderReferenceId>
          <CreationTimestamp>2017-11-14T07:24:02.186Z</CreationTimestamp>
          <BillingAddress>
              <PhysicalAddress>
                <City>Neunkirchen</City>
                <CountryCode>DE</CountryCode>
                <PostalCode>66538</PostalCode>
                <Name>Liam Barker</Name>
                <AddressLine1/>
                <AddressLine2>Meininger Strasse 58</AddressLine2>
              </PhysicalAddress>
              <AddressType>Physical</AddressType>
          </BillingAddress>
          <RequestPaymentAuthorization>false</RequestPaymentAuthorization>
        </OrderReferenceDetails>
        ...
    </GestPayS2S>
  </callReadTrxS2SResult>
</callReadTrxS2SResponse>