APG PayAPG Paydocs

Payment sources

Create pay to agreements

POST/pay-to-agreements

Ask a payer for a standing authority. The response carries the token, it is the only handle you get.

Permissions

Required permission
payToAgreements:create

Requires the `create` action on `payToAgreements` for the supplied runtime context

Request body

This body is a tagged shape: type is always "PtagCmdAsk". Send it; more variants can be added, and a caller that switches on it keeps working when they are.

Discriminated by type
type = "PtagCmdAsk"
merchantIdMchtIdrequired

Identifier of a merchant.

Example mcht_9f2Kd8QpLzXw

customerIdCustId

The customer this is for. Supplying it narrows the authorisation to that customer.

Example cust_9f2Kd8QpLzXw

customerAccountNamestringrequired

The account name as the payer's bank holds it. A mismatch is a declined agreement, resolve it with /pay-to-aliases first.

Example Ada Lovelace

purposePtagPurpose

What the debits are for. The payer's bank is told, and the payer sees it when they approve.

MortgageUtilityLoanDependantSupportGamblingRetailSalaryPersonalGovernmentPension
+1 more

Unknown

curl -X POST https://api.tst.au.apgpay.dev/pay-to-agreements \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "PtagCmdAsk",
  "merchantId": "mcht_9f2Kd8QpLzXw",
  "customerId": "cust_9f2Kd8QpLzXw",
  "customerAccountName": "Ada Lovelace",
  "account": {
    "type": "PtagAccountAlias",
    "aliasType": "Phone",
    "alias": "string"
  },
  "terms": {
    "type": "PtagTermsOneOff",
    "amount": {
      "type": "IsoCurrencyAmount",
      "minorCurrencyUnits": 1250,
      "currency": "AUD"
    }
  },
  "purpose": "Mortgage"
}'

Responses

The response is a tagged shape: type is always "PtagCreateRspAttributes". Switch on it; subtypes can be added, and a client that already reads it will not break.

Discriminated by type
type = "PtagCreateRspAttributes"

The resource that was created.

Example
{
  "type": "PtagCreateRspAttributes",
  "created": {
    "type": "PtagViewAttributes",
    "token": "tok_9f2Kd8QpLzXwR4mN",
    "merchantId": "mcht_9f2Kd8QpLzXw",
    "customerId": "cust_9f2Kd8QpLzXw",
    "status": "Pending"
  }
}

Error responses