Set payment info

[Step 4 of 10] In this step, you will set the order total and specify how the buyer should be charged. At the end of this step, you will be able to redirect the buyer to a unique amazonRedirectUrl for transaction processing.


1. Set payment info

Call Update Checkout Session to set payment info (such as the order amount) and transaction metadata. Use the checkoutResultReturnUrl parameter to specify the URL the buyer is redirected to after checkout is completed on the Amazon Pay-hosted page.

Set chargeAmount to the value that should be processed using the paymentIntent during checkout. If you need to split the order to capture additional payment after checkout is complete, use the optional totalOrderAmount parameter to set the full order amount.

Request

Request body

{
    "webCheckoutDetails": {
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page"
    },
    "paymentDetails": {
        "paymentIntent": "AuthorizeWithCapture",
        "canHandlePendingAuthorization":false,
        "softDescriptor": "Descriptor",
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        }
     },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    }
}

Request parameters

Name
Location
Description
checkoutSessionId
(required)

Type: string
Path parameter
Checkout Session identifier
webCheckoutDetails

Type: webCheckoutDetails
Body
Checkout result URL provided by the merchant. Amazon Pay will redirect to this URL after completing the transaction

Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl
recurringMetadata

Type: recurringMetadata
Body
Metadata about how the recurring Charge Permission will be used. Amazon Pay only uses this information to calculate the Charge Permission expiration date and in buyer communication

Note that it is still your responsibility to call Create Charge to charge the buyer for each billing cycle
paymentDetails

Type: paymentDetails
Body
Payment details specified by the merchant such as the amount and method for charging the buyer

Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl
merchantMetadata

Type: merchantMetadata
Body
External order details provided by the merchant

Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl
platformId

Type: string
Body
Merchant identifier of the Solution Provider (SP).

Only SPs should use this field.

Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl.
providerMetadata

Type: providerMetadata
Body
Transaction identifier created by the Payment Service Provider (PSP)

Only PSPs should use these fields

Modifiable: Multiple times before the buyer is redirected to the amazonPayReturnUrl

Sample Code

Response

{
    "checkoutSessionId": "bd504926-f659-4ad7-a1a9-9a747aaf5275",
    "webCheckoutDetails": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page",
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page",
        "checkoutCancelUrl": null,
        "amazonPayRedirectUrl": "https://pay.amazon.com/redirect/checkoutId-1"
    },
    "chargePermissionType": "Recurring",   
    "recurringMetadata": {
        "frequency": { 
            "unit": "Month", 
            "value": "1" 
        },
        "amount": { 
            "amount": "30",
            "currencyCode": "USD"
        }
    },
    "productType": "PayAndShip",
    "paymentDetails": {
        "paymentIntent": "AuthorizeWithCapture",
        "canHandlePendingAuthorization": false,
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        },
        "totalOrderAmount": null,
        "softDescriptor": "Descriptor",
        "presentmentCurrency": "USD",
        "allowOvercharge": null,
        "extendExpiration": null
    },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    },
    "supplementaryData": null, // Amazon Pay system data 
    "buyer": {
        "buyerId": "buyerId",
        "name": "name-1",
        "email": "name@amazon.com",
        "phoneNumber": "800-000-0000",
        "primeMembershipTypes": null
    },
    "billingAddress":{ 
        "name": "Work",
        "addressLine1": "440 Terry Ave",
        "addressLine2": "",
        "addressLine3": "",
        "city": "Seattle",
        "county": "King",    
        "district": "Seattle",
        "stateOrRegion": "WA",
        "postalCode": "98121",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "paymentPreferences": [
        {
            "paymentDescriptor": "Visa ****1111 (Amazon Pay)"
        }
    ],
    "statusDetails": {
        "state": "Open",
        "reasonCode": null,
        "reasonDescription": null,
        "lastUpdatedTimestamp": "20191015T195703Z"
    },
    "shippingAddress": {  // Null for PayOnly product type
        "name": "Susie Smith",
        "addressLine1": "10 Ditka Ave",
        "addressLine2": "Suite 2500",
        "addressLine3": null,
        "city": "Chicago",
        "county": null,
        "district": null,
        "stateOrRegion": "IL",
        "postalCode": "60602",
        "countryCode": "US",
        "phoneNumber": "800-000-0000"
    },
    "platformId": null,
    "chargePermissionId": null,
    "chargeId": null,
    "constraints": [],
    "creationTimestamp": "20191015T195655Z",
    "expirationTimestamp": "20191016T195655Z",
    "storeId": "amzn1.application-oa2-client.8b5e45312b5248b69eeaStoreId",
    "deliverySpecifications": {
        "specialRestrictions": ["RestrictPOBoxes"],
        "addressRestrictions": {
            "type": "Allowed",
            "restrictions": {
                "US": {
                    "statesOrRegions": ["WA"],
                    "zipCodes": ["95050", "93405"]
                },
                "GB": {
                    "zipCodes": ["72046", "72047"]
                },
                "IN": {
                    "statesOrRegions": ["AP"]
                },
                "JP": {}
            }
        }
    },
    "providerMetadata": {
        "providerReferenceId": null
    },
    "checkoutButtonText": null,
    "releaseEnvironment": "Sandbox"
}

2. Redirect to AmazonPayRedirectUrl

Update Checkout Session response will include a Constraint object until all mandatory parameters have been provided. The mandatory parameters are:

  • checkoutResultReturnUrl
  • chargeAmount
  • paymentIntent
  • recurringMetadata.frequency

Once there are no constraints, the response will return a unique amazonPayRedirectUrl. Redirect the buyer to that URL to complete checkout.