Grato por sua visita. Neste momento esta página está apenas disponível em inglês.
 Step 3: Obtain the buyer's authorization for recurring payments | Amazon Pay

Step 3: Obtain the buyer's authorization for recurring payments

To enable recurring payments, you must display the Amazon Authorize Recurring Payments widget. Using this widget, the buyer can authorize you to charge their Amazon account for future purchases and payments, like subscriptions or bill payments. This consent provides you the flexibility to charge variable amounts subject to our recurring payments policy over an indefinite period of time to support subscriptions, usage-based billing, and other recurring payments scenarios.

To embed the Repeat Payment Authorization widget on your website, add the following sample code to your webpage:

 
<!--- put the style below inside your CSS file -->
<style type="text/css">
    #consentWidgetDiv {width: 400px; height: 140px;}
 </style>

<div id="consentWidgetDiv">
</div>
<script>
new OffAmazonPayments.Widgets.Consent({
  sellerId: 'YOUR_SELLER_ID_HERE',
  // amazonBillingAgreementId obtained from the Amazon Address Book widget. 
  amazonBillingAgreementId: amazonBillingAgreementId, 
  design: {
    designMode: 'responsive'
  },
  onReady: function(billingAgreementConsentStatus){
    // Called after widget renders
    buyerBillingAgreementConsentStatus =
      billingAgreementConsentStatus.getConsentStatus();
    // getConsentStatus returns true or false
    // true - checkbox is selected
    // false - checkbox is unselected - default
  },
  onConsent: function(billingAgreementConsentStatus) {
    buyerBillingAgreementConsentStatus =
      billingAgreementConsentStatus.getConsentStatus();
    // getConsentStatus returns true or false
    // true - checkbox is selected - buyer has consented
    // false - checkbox is unselected - buyer has not consented

    // Replace this code with the action that you want to perform
    // after the consent checkbox is selected/unselected.
   },
  onError: function(error) {
    // your error handling code
   }
}).bind("consentWidgetDiv ");
</script>
    

You must specify the amazonBillingAgreementId when rendering the Authorize Recurring Payment widget. If the amazonBillingAgreementId is not specified, the widget will show an error message.

When creating the Authorize Recurring Payment widget, you must specify width and height parameters; otherwise, the widgets do not render. The recommended and valid width and height parameters are specified in the following table:

Parameter Recommended dimension Valid dimensions
width 400px 300px - 600px
height 140px 140px - 400px

Amazon recommends that you disable the checkout workflow until the buyer has checked the check box in the widget to provide their consent. Amazon notifies you of the consent status through the billingAgreementConsentStatus callback functions. If the checkbox is checked, the buyerBillingAgreementConsentStatus is set to true, otherwise it is set to false. You can also get the BillingAgreementConsentStatus by calling the GetBillingAgreementDetails operation. For more information, see GetBillingAgreementDetails in the Amazon Pay API reference guide.

Based on the consent status, you can enable the next step in your checkout flow. For example, you can enable the Continue button on your webpage if you have an order review page that follows, or you can enable the Subscribe button for the buyer to complete the purchase. Note that you cannot confirm the Billing Agreement until the buyerBillingAgreementConsentStatus is set to true.