PaymentAgreementRequest API
Overview
The PaymentAgreementRequest API works with the Subscriptions App to provide a hosted PayTo agreement setup experience.
After the customer authorises the agreement, you can collect eligible payments through the Payment Initiation API. Alternatively, include the optional scheduler object when creating the request to have Azupay automatically create a payment schedule after the agreement becomes active.
Omitting scheduler creates an agreement-only setup. It does not create a schedule or automatically initiate payments.
API References
| API | Description | Method |
|---|---|---|
| Create a PaymentAgreementRequest | Allows you to create a PayTo payment agreement for your customer using the Subscriptions UX solution. | POST |
How do I use Subscriptions UX solution via API?
In order to use Azupay's Subscription UX solution, you need to do the following:
- Obtain a one-time link URL and a tentative
paymentAgreementIdusing the POST/PaymentAgreementRequest
API. At this point the Payment Agreement has not been created yet. You must use an API Key (API_KEY) with
permissions forPOST/PaymentAgreementRequest.
Request
Agreement-only example: This request does not include scheduler, so no payment schedule is created automatically.
POST https://api.azupay.com.au/v1/paymentAgreementRequest
Authorization: {{API_KEY}}
Content-Type: application/json
{
"PaymentAgreementRequest": {
"clientTransactionId": "b844123d-0f45-498d-bcd3-ff84cd267407",
"agreementMaximumAmount": "900.00"
}
}Response
HTTP/2 201 Created
content-type: application/json
{
"PaymentAgreementRequest": {
"clientTransactionId": "b844123d-0f45-498d-bcd3-ff84cd267407",
"agreementMaximumAmount": "900.00"
},
"PaymentAgreementRequestStatus": {
"paymentAgreementId": "ee55da07d8bcb3d3077f1def7b958e2b",
"sessionUrl": "https://subscriptions.apps.azupay.com.au/78e7941b6c844f70b50292ce5d4325b8"
}
}- Save the
paymentAgreementIdagainst the authenticated user identifier for the payer so that you can use it to
take payments later. - Redirect your payer into this one-time link (
sessionUrl) and provide bothredirectURLandcancelRedirectURLas URL encoded query parameters so that your system can be notified of the outcome. - Use agreement status updates to confirm when the agreement becomes ACTIVE. If you omitted scheduler, you can then initiate eligible payments through the Payment Initiation API. If you included scheduler, Azupay automatically creates the payment schedule after activation.
- If the payer fails to complete the process, they will be directed to the
cancelRedirectURLand you can optionally start the process again.
Optional automatic scheduling
Include scheduler in your PaymentAgreementRequest to automatically create a recurring payment schedule after the customer authorises the agreement and it becomes active.
The schedule uses the confirmed payment frequency, start date and amount from the Subscriptions setup. You do not need to make a separate schedule-creation request.
The scheduler object requires a timezone using an IANA timezone name, such as Australia/Sydney. There is no default timezone.
Example request with automatic scheduling
{
"PaymentAgreementRequest": {
"clientTransactionId": "b844123d-0f45-498d-bcd3-ff84cd267407",
"agreementMaximumAmount": "900.00",
"agreementFrequency": "MONTHLY",
"agreementStartDate": "2027-01-01",
"scheduler": {
"timezone": "Australia/Sydney"
}
}
}
This example requests monthly collections of $900, with the first scheduled collection on 1 January 2027 in the Australia/Sydney timezone. Use a future start date appropriate to your integration.
What to expect
- Returning a sessionUrl does not mean the agreement is active or the schedule has been created.
- Automatic schedule creation occurs after agreement activation.
- Agreement approval, successful schedule creation and payment settlement are separate outcomes.
- Omitting scheduler leaves payment collection under your control through the Payment Initiation API or a separately created schedule.
See the PaymentAgreementRequest API reference for request fields and the PaymentSchedule API guide for schedule management and collection behaviour.
Controlling how long the payer has to authorise
By default, the payment agreement created when calling the Payment Agreement Request API remains valid for 10 minutes. If the payer does not complete authorisation within that time, the payment agreement expires.
Use agreementExpiryMinutes to set a longer or shorter window, for example to give payers more time to login to their online banking or mobile banking to authorise the agreement.
- agreementExpiryMinutes is optional and is an integer number of minutes
- the minimum is 5 and the maximum is 7199
- when omitted, the expiry defaults to 10 minutes
Example request with a 60 minute expiry:
{
"PaymentAgreementRequest": {
"clientTransactionId": "b844123d-0f45-498d-bcd3-ff84cd267407",
"agreementMaximumAmount": "900.00",
"agreementExpiryMinutes": 60
}
}Updated 11 days ago
