Step 4: Set billing agreement details and confirm the agreement
The Billing Agreement object
By default, when a buyer authenticates with Amazon Pay, as shown in Step 1: Add a Button widget for buyer authentication or when you render the Address or Wallet widget without specifying the Billing Agreement Id, Amazon Pay creates a system object called the billing agreement. This object stores all the attributes associated with the payment that the buyer is going to make using Amazon Pay.
At this point in the Amazon Pay checkout process, the Billing Agreement object has been populated with the buyer's shipping address, payment method choices, and consent for recurring payments. Now, you must set additional attributes in the Billing Agreement object that help associate the billing agreement with any other details that you are tracking. For example, you can set details like the order or subscription number that you have specified for the transaction and a note that is shown to the buyer in emails sent by Amazon Pay.
After you set these attributes by calling the SetBillingAgreementDetails operation, you must confirm the purchase to Amazon Pay by calling the ConfirmBillingAgreement operation. After you confirm the billing agreement, Amazon Pay informs the buyer that you authorized a payment method to be used for this billing agreement. You must confirm the billing agreement before you process the payment for the order.
Setting the billing agreement details
To set the specifics of the Billing Agreement object, you call the SetBillingAgreementDetails operation. It enables you to provide any additional information about the recurring payment that you would like included in the Billing Agreement object. This additional information is used in both buyer-facing communications from Amazon Pay as well as in payment processing information returned to you.
Amazon Pay limits the maximum charge to $1000 per calendar month for each billing agreement. You can check this limit by calling the GetBillingAgreementDetails operation.
The following example shows how to call the SetBillingAgreementDetails operation:
https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01? AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE &AmazonBillingAgreementId=C01-8824045-7416542 &Action=SetBillingAgreementDetails &BillingAgreementAttributes.PlatformId=PLATFORM_ID_HERE &BillingAgreementAttributes.SellerNote=APPROVE LITE APPROVE HEAVY &BillingAgreementAttributes.SellerBillingAgreementAttributes.CustomInformati on=Example Customer Info &BillingAgreementAttributes.SellerBillingAgreementAttributes.StoreName=Test Store Name &MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE &SellerId=YOUR_SELLER_ID_HERE &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2013-12-11T10:57:18.000Z &Version=2013-01-01 &Signature=Z0ZVgWu0ICF4FLxt1mTjyK+jdYG6Kmm8JxLTfsQtKRY=
For more information about the SetBillingAgreementDetails operation including the request parameters and response elements, see SetBillingAgreementDetails in the Amazon Pay API reference guide.
Confirming the billing agreement details
After setting the attributes for the Billing Agreement object (including any additional attributes that you want to add through the SetBillingAgreementDetails operation call), you must confirm the Billing Agreement object. This step informs Amazon Pay that the buyer has placed the order on your site. Confirming the Billing Agreement object does not guarantee funds or put funds on hold. For this, you need to submit a request to Amazon Pay to authorize the payment and capture funds.
Note: You cannot confirm a billing agreement if the buyer has not been able to choose an address or payment method or if the buyer has not authorized recurring payments from the Authorize Recurring Payment widget.
When a billing agreement cannot be confirmed, it has constraints on it. If you are using an order review page, call the GetBillingAgreementDetails operation before rendering the order review page to check for constraints.
If there are constraints related to address, payment, or buyer consent, you should disable the confirm button on your website until the buyer has picked an address and/or payment instrument.
If you attempt to confirm a billing agreement that has constraints on it, you get an error response showing the specific constraint violations.
You should not show the order confirmation page to your buyers unless the ConfirmBillingAgreement operation was successful and without constraints.
You confirm the Billing Agreement object by calling the ConfirmBillingAgreement operation.
The following example shows how to call the ConfirmBillingAgreement operation:
https://mws.amazonservices.com/OffAmazonPayments_Sandbox/2013-01-01?AWSAccessKeyId=AKIAJKYFSJU7PEXAMPLE &AmazonBillingAgreementId=C01-8824045-7416542 &Action=ConfirmBillingAgreement &MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE &SellerId=YOUR_SELLER_ID_HERE &SignatureMethod=HmacSHA256 &SignatureVersion=2 &Timestamp=2013-12-11T11:37:19.000Z &Version=2013-01-01 &Signature=ET6V00R4fr2inSDky4olLrlS1XrQfdrV9Bj+iWebz1c=
For more information about the ConfirmBillingAgreement operation, including the request parameters and response elements, see ConfirmBillingAgreement in the Amazon Pay API reference guide.
After successfully calling the ConfirmBillingAgreement operation, the Billing Agreement object moves from the Draft state to the Open state. For more information on state transitions, see Synchronizing your systems with Amazon Pay.
If you are using the Amazon Pay button (guest checkout) option, only the partial shipping address is shared with you until you confirm the Billing Agreement object by calling the ConfirmBillingAgreement operation. You can use this partial address to compute taxes and shipping costs. Amazon Pay recognizes that you need further details about the customer and the full shipping address to process your order and offer customer service. After you confirm a Billing Agreement object by calling the ConfirmBillingAgreement operation, you should get the full shipping address by calling the GetBillingAgreementDetails operation and verify that you can ship to that address.
When using the Amazon Pay button (guest checkout) option, the following customer information is made available to you after the Billing Agreement object is confirmed:
|Buyer detail||How and when to obtain|
|Buyer name||Call the GetBillingAgreementDetails operation after you successfully call the ConfirmBillingAgreement operation.|
|Buyer email address||Call the GetBillingAgreementDetails operation after you successfully call the ConfirmBillingAgreement operation.|
|Buyer phone number (if available)||Call the GetBillingAgreementDetails operation after you successfully call the ConfirmBillingAgreement operation.|
Partial address information (City, StateOrRegion, PostalCode, and CountryCode) can be obtained by calling the GetBillingAgreementDetails operation immediately after an address is selected in the AddressBook widget. Full address information (including street information) is obtained by calling the GetBillingAgreementDetails operation after you successfully call the ConfirmBillingAgreement operation.
Note: If you want to access full shipping address before confirming the billing agreement, you should use the payments:shipping_address scope. For more details, refer to Step 1: Add a Button widget for buyer authentication in this guide.
|Recipient phone number (if available)|
At this point, we strongly recommend that you proceed with your existing buyer-facing order confirmation business processes (confirmation email, confirmation landing page, etc.) if you are using the asynchronous mode of authorization, as the following steps of authorizing and capturing the payment method take additional time to process.
After the Billing Agreement object is in the Open state, you can proceed with processing your buyer's payment.
Buyer email to confirm recurring payments setup
As soon as the Billing Agreement object is in the Open state, Amazon Pay sends a Payment Method Setup email to the buyer notifying them that they have authorized you to automatically charge their Amazon Pay account.
Note: Amazon Pay lets you specify various pieces of information in the emails sent by Amazon Pay, like, for example, your customer service email address, phone number, or the note from the seller. For more information about these details, please refer to Buyer-facing email content that you can provide.