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?
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.