2

I am working on integrating amazon pay for billing agreements. To my understanding amazon requires me to call their api, authorize, and capture each time I want to charge a buyer during the billing agreement.

For instance, if a buyer has agreed to a monthly payment, I need to call the amazon api each month to make that transaction.

I was wondering if there is a way to manage subscriptions and automate capturing funds against billing agreements, if not what would be a good system design to implement this feature?

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
ahmaxed
  • 181
  • 10

1 Answers1

3

The Amazon Pay recurring product does not have an automatic billing feature. If you want to automate this, you can set up a cron job that runs at your desired cadence and makes the AuthorizeOnBillingAgreement API call.

If you want Amazon Pay to automatically capture upon a successful auth, make sure to pass true to the CaptureNow parameter.

As this sounds like a rebilling workflow, you can also pass 1440 to the TransactionTimeout parameter to provide more time for the authorization to complete, which should translate to a higher auth success rate.

Another option in case you're interested in a serverless option, you could use AWS services to trigger this on a cron-like basis - more details available in the AWS Lambda documentation. There's also a great re:Invent talk on using Lambda as Cron from 2015.

Disclaimer: I work for Amazon Pay.

Matt
  • 1,300
  • 2
  • 14
  • 31
  • Thank you mentioning AuthorizeOnBillingAgreement. I am following this [sync diagram](https://m.media-amazon.com/images/G/01/EPSDocumentation/AmazonPay/Integration/diagram_OrderConfirm-and-OptimalAuth-with-IPNhandler.png) which suggests making a TransactionTimeout:0 call initially so I could handle "InvalidPaymentMethod" while the user is around; however, it also suggests handing the same error when receiving the IPN. Would the second error handling be necessary? – ahmaxed May 19 '20 at 08:19
  • Also related to managing billing agreements, I was wondering if emailing customers regarding their failed or successful auth is mandatory? – ahmaxed May 19 '20 at 08:31
  • 1
    @user2472167 - if the user is present, you should use the sync model to allow for InvalidPaymentMethod decline handling. And regarding emailing the customer, it is not mandatory. – Matt May 19 '20 at 14:35
  • Thank you for confirming. I read in the [Automatic Payments Policy](https://pay.amazon.com/help/201498120) that automatic payment agreement details "must also be included in an email you provide to the buyer after they authorize the recurring payment arrangement". Still not sure at which stage this automated email should be sent out. – ahmaxed May 19 '20 at 14:59
  • 1
    Per that policy, you do need to confirm via email, but there is no requirement to do so on a per auth basis. – Matt May 19 '20 at 18:18