When the user clicks the 'Continue' button from our form, we will set and confirm the order reference. The authorize and capture calls can take a little longer, so we may want to perform those asynchronously after the user has been sent to the thank you page.
This SDK will be really useful: https://github.com/amzn/login-and-pay-with-amazon-sdk-php
This proof-of-concept patch illustrates some of the calls: https://gerrit.wikimedia.org/r/229278
Should also add a mock of the SDK client interface and a couple of tests for different responses