PaymentInitiation APIs

Payment Initiation

Once you have an active Payment Agreement in place you can automatically collect eligible payments aligned to the terms of the Payment Agreement.

🚧

Eligible payments only

You must only collect payments you are legally entitled to under a commercial arrangement you have with your customer. Your payment initiations must also align with the terms of the Payment Agreement you have with that customer, e.g. your payment initiations must be no more than the maximum amount in the Payment Agreement, your payment types must correspond to the payment type specified in the Payment Agreement, your frequency of payments must be consistent with the frequency terms in the Payment Agreement, and other conditions.

If you do initiate an ineligible payment you may find the payment can be reversed at a later time. In general, since your customer has approved the Payment Agreement in their bank there are far fewer situations in which payments are reversed than in other similar payment methods such as Direct Debit or card payments.

To make a payment initiation follow the payload example below:

POST https://api.azupay.com.au/v1/paymentInitiation
Authorization: SECR_MYBUSINESSID_myapikey
Content-Type: application/json
{
  "PaymentInitiation": {
    "paymentInitiationNotification": {
      "endpointURL": "https://mybusiness.free.beeceptor.com",
      "authorizationHeader": "my-secret-header"
    },
    "clientId": "MYBUSINESSID",
    "clientTransactionId": "INV-0000001-1",
    "paymentAmount": "99.99",
    "paymentAgreementId": "86ea437729e81567218cd013aa5e3d36"
  }
}

Objects to note in this request:

  • paymentInitiationNotification: As the payment initiation is an asynchronous request, a webhook is required so that your business can be notified once the payment initiation has been completed.

🚧

Failed payments refund behaviour

If a payment initiation is not settled or rejected within 24 hours since it is initiated, it will be marked as FAILED. Any payment received afterward will be refunded.

Status Code and Status Reason

PaymentInitiationStatus.status field will change for different reasons.

The underlying reason will be captured as status code in the PaymentInitiationStatus.statusCode field.
These codes are standard across the NPP network participants and are returned by the destination institution as opposed to Azupay.

The reason description will be captured in the PaymentInitiationStatus.statusReason field.

statusstatusCodestatusReason
PENDINGRECVReceived
PENDINGUNDVUndelivered
PENDINGSENTSent
PENDINGSAFDStore & Forward
PENDINGACCPAccepted for clearance by Receiver
PENDINGACSPSettlement aborted by NPP BI
SETTLEDACSCAccepted & Settled
FAILEDAB01Clearing process aborted due to timeout. NPP Error. Client should retry for up to 8 hours before failing the payment and debiting the customers account.
FAILEDAB02Clearing process aborted due to fatal error. NPP Error. Client should retry for up to 8 hours before failing the payment and debiting the customers account.
FAILEDAB03Settlement aborted due to timeout. Clients should retry every 30 minutes for up to 8 hours. If this continues to fail afterwards, please contact support.
FAILEDAB04Settlement aborted due to timeout. Clients should retry every 30 minutes for up to 8 hours. If this continues to fail afterwards, please contact support.
FAILEDAB08Settlement aborted due to timeout. Clients should retry every 30 minutes for up to 8 hours. If this continues to fail afterwards, please contact support.
FAILEDAC02The Debtor Account Number is invalid or missing.
FAILEDAC03The Payee is unable to accept a Clearing Request because the account to be debited does not exist.
FAILEDAC05The original debtor account number is closed and a Payment Return (Unsolicited) cannot be made.
FAILEDAC06The Account is blocked and cannot accept debits. This includes instances of suspected fraud, sanctions or a debit is unable to be applied to the account type e.g. mortgage, term deposit account.
FAILEDAC13Merchants should never receive this error if a valid PayTo agreement is already in place.
FAILEDAC15Please contact support for further investigation.
FAILEDAG01Merchants should never receive this error if a valid PayTo agreement is already in place.
FAILEDAG07Please contact support for further investigation.
FAILEDAM01The service prohibits the use of zero dollar Payments.
FAILEDAM02The transaction is greater than the maximum NPP limit of $99,999,999,999 or rules of a service have a maximum amount limit.
FAILEDAM04Insufficient funds. Please try again later up to 5 times within 24 hours.
FAILEDAM06Amount requested does not match payment agreement. Please update amount and try again.
FAILEDAM09Amount requested does not match payment agreement. Please update amount and try again.
FAILEDAM12Amount is missing. You will receive a schema validation error when calling the API.
FAILEDAM21Amount requested does not match payment agreement. Please update amount and try again.
FAILEDBE06Merchants should never receive this error if a valid PayTo agreement is already in place.
FAILEDDT02Temporary error, please try again.
FAILEDED05Settlement failed. Please try again later up to 5 times within 24 hours.
FAILEDED06Interbank settlement system unavailable. Please try again later up to 5 times within 24 hours.
FAILEDFF10Bank system error. Please try again later up to 5 times within 24 hours.
FAILEDFF11Clearing request error. Please try again later up to 5 times within 24 hours.
FAILEDSL13Maximum number of transactions exceeds payment agreement.
FAILEDSL14Maximum amount exceeds payment agreement.
FAILEDE991Bank system error. Please try again later up to 5 times within 24 hours.
FAILEDE992Bank system error. Please try again later up to 5 times within 24 hours.
FAILEDM901Bank system error. Please try again later up to 5 times within 24 hours.
FAILEDM902Online transactions will be rejected, please try again later. Batch payment initiations will be queued for delivery automatically once participants are back online.
FAILEDM903Online transactions will be rejected, please try again later. Batch payment initiations will be queued for delivery automatically once participants are back online.
FAILEDM904Online transactions will be rejected, please try again later. Batch payment initiations will be queued for delivery automatically once participants are back online.
FAILEDM905A cancelled PayID should result in payment agreements being cancelled. Please contact support if you receive this error.
FAILEDM914Porting is not currently available.
FAILEDM915Porting is not currently available.
FAILEDE999Fatal error. Please contact support if you receive this error.
FAILEDPA04Possible NPP outage. Clients should retry every 30 minutes for up to 8 hours. If this continues to fail afterwards, please contact support.

Failure Codes and Failure Reasons

When:

  • creating a payment agreement
  • amending a payment agreement
  • creating a payment initiation

in 400 error scenarios, you may get a response with an optional details object containing a:

  • failureCode and
  • failureReason

Example:

{
  "message": "PayID format is incorrect",
  "details": {
    "failureCode": "AZP5.2",
    "failureReason": "PayID format is incorrect"
  }
}

Below are the mappings for the codes and reasons:

failureCodefailureReason
AZP5.1[object must not contain both (["payIDDetails"]) and (["bankAccountDetails"])]
AZP5.2PayID format is incorrect
AZP5.3["additionalDetails" object must contain (["deviceFingerprint"]) and (["ipAddress"]) when channelType is BROWSER or MOBILE]
AZP5.4["additionalDetails" object must contain (["ipAddress"]) when (["channelType"]) is BROWSER or MOBILE]
AZP5.5["additionalDetails" object must contain (["deviceFingerprint"]) when (["channelType"]) is BROWSER or MOBILE]
AZP5.6object must contain either (["variableAgreementDetails"]) or (["fixedAgreementDetails"]) or ([balloonAgreementDetails"]) or (["usageBasedAgreementDetails"]
AZP5.7[object must contain only one of (["variableAgreementDetails"]) or (["fixedAgreementDetails"]) or ([balloonAgreementDetails"]) or (["usageBasedAgreementDetails"])
AZP5.8An invalid request body was supplied
AZP5.9[object has missing required properties (["mandatoryField"])]
AZP5.10Invalid DDR migration request. Both BECS User ID and PayID have been provided
AZP5.11The BECS User ID is invalid
AZP5.12[object must contain either (["payIDDetails"]) or (["bankAccountDetails"])]
AZP5.13Start date must be today or future dated
AZP5.14End date must be equal to or after start date
AZP5.15Last payment date must be equal to or after start date
AZP5.16End date must be equal to or after end date
AZP5.17Last payment date must be equal to or after end date

Issuing Refunds

Full refunds

Once you have received a payment initiation, and it is in SETTLED status you can do a full refund by performing an API call like the following, again using the paymentInitiationId:

POST https://api.azupay.com.au/v1/paymentIntiation/refund?id=a050551479f625c066b559da28fee33c
Authorization: SECR_MYBUSINESSID_myapikey
Content-Type: application/json

You will get a response like the following

{
  "PaymentInitiation": {
    ...
  },
  "PaymentInitiationStatus": {
    ...
    "status": "RETURN_IN_PROGRESS",
    "refundInformation": {
      "availableBalance": "0.00",
      "requests": [
        {
          "createdDateTime": "2021-04-25T23:52:56.189Z",
          "nppTransactionId": "AZTPAU22XXXN20230419100000000000020",
          "status": "IN_PROGRESS",
          "amount": "500.00"
        }
      ]
    }
  }
}

The status of the PaymentInitiation will go into RETURN_IN_PROGRESS which means it has been initiated but not completed yet.

After some time, and assuming you have enough balance with Azupay to perform the refund, you can enquire about the status for the PaymentInitiation and see a change on the status to RETURN_COMPLETE indicating the refund has completed successfully.

{
  "PaymentInitiation": {
    ...
  },
  "PaymentInitiationStatus": {
     ...
    "status": "RETURN_COMPLETE",
    "refundInformation": {
      "availableBalance": "0.00",
      "requests": [
        {
          "createdDateTime": "2021-04-25T23:52:56.189Z",
          "completedDateTime": "2021-04-25T23:52:58.189Z",
          "nppTransactionId": "AZTPAU22XXXN20230419100000000000020",
          "status": "COMPLETE",
          "amount": "500.00"
        }
      ]
    }    
  }
}

Partial refunds

To do a partial refund you would submit a similar request than for full refund but adding a refundAmount query parameter to the request.

Say you have a completed PaymentInitiation for $100 and you do a partial refund of $25 using a POST like the following.

POST https://{{api-host}}/v1/paymentInitiation/refund?id=a050551479f625c066b559da28fee33c&refundAmount=25
Authorization: SECR_MYBUSINESSID_myapikey
Content-Type: application/json

Once the refund is completed, when you enquire on the PaymentInitiation you will see a response like the one below.

{
  "PaymentInitiation": {
    ...
  },
  "PaymentInitiationStatus": {
    ...,
    "refundInformation": {
      "availableBalance": "75.00",
      "requests": [
        {
          "nppTransactionId": "AZTPAU22XXXN20230419100000000000020",
          "createdDateTime": "2021-04-22T06:40:25.198Z",
          "completedDateTime": "2021-04-23T05:42:09.373Z",
          "status": "COMPLETE",
          "amount": "25.00"
        }
      ]
    },
    "status": "RETURN_COMPLETE",
  }
}

The latest entry in the refundInformation object will contain the information about the partial refund.