Gracias por tu visita. Esta página solo está disponible en inglés.

Set payment info

[Step 4 of 8] To complete checkout, set payment details, and redirect to amazonPayRedirectUrl.


1. Set payment info.

Update Checkout Session to set payment info and transaction metadata. Note that you can only set payment info while the Checkout Session object is in an Open state.

Use the checkoutResultReturnUrl parameter to specify the URL the buyer is redirected to after checkout is completed on the Amazon Pay-hosted page.

Request

curl "https://pay-api.amazon.com/:environment/:version/checkoutSessions/:checkoutSessionId" \
-X PATCH
-H "x-amz-pay-authorization: Px2e5oHhQZ88vVhc0DO%2FsShHj8MDDg%3DEXAMPLESIGNATURE"
-d @request_body

Request body

{
    "webCheckoutDetail": {
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page"
    },
    "paymentDetail": {
        "paymentIntent": "Authorize",
        "canHandlePendingAuthorization": false,
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        }
     },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    },
    "platformId": "SPId"
}

Request parameters

Name
Location
Description
checkoutSessionId
(required)

Type: string
Path parameter
Checkout Session identifier
webCheckoutDetail

Type: webCheckoutDetail
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
paymentDetail

Type: paymentDetail
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.

Response

{
    "checkoutSessionId": "ada3f397-7d4b-4a55-abac-786685c02d8b",
    "webCheckoutDetail": {
        "checkoutReviewReturnUrl": "https://a.com/merchant-review-page",
        "checkoutResultReturnUrl": "https://a.com/merchant-confirm-page",
        "amazonPayRedirectUrl": "https://pay.amazon.com/redirect/checkoutId-1"
    },
    "productType": "PayAndShip",
    "paymentDetail": {
        "paymentIntent": "Authorize",
        "canHandlePendingAuthorization":false,
        "chargeAmount": {
            "amount": "1",
            "currencyCode": "USD"
        },
        "softDescriptor": null,
        "presentmentCurrency": "USD"
    },
    "merchantMetadata": {
        "merchantReferenceId": "Merchant reference ID",
        "merchantStoreName": "Merchant store name",
        "noteToBuyer": "Note to buyer",
        "customInformation": "Custom information"
    },
    "supplementaryData": null, // Amazon Pay system data 
    "buyer": {
        "buyerId": "amzn1.account.AH34VHFHHYL4YMBuyerId",
        "name": "name-1",
        "email": "name@amazon.com"
    },
    "paymentPreferences": [
        {
            "paymentDescriptor": "Visa ****1111 (Amazon Pay)",
            "billingAddress":{  // Only available in EU or for PayOnly product type
                "name": "Work",
                "addressLine1": "440 Terry Ave",
                "addressLine2": "",
                "addressLine3": "",
                "city": "Seattle",
                "county": "King",    
                "district": "Seattle",
                "stateOrRegion": "WA",
                "postalCode": "98121",
                "countryCode": "US"
            }
        }
    ],
    "statusDetail": {
        "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": "AEMGQX8TKDO54",
    "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 are provided. The mandatory parameters are:

  • checkoutResultReturnUrl
  • chargeAmount
  • paymentIntent

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