Skip to content
ShaBaas Pay / Docs
Technical Guides

Payment Initiation setup

Request a PayTo payment against an agreement the payer has already approved. Call ShaBaas with a bearer token. ShaBaas debits the payer and returns a payment_initiation_id.

Set this up in the sandbox first. Production uses the same calls against https://api.shabaas.com with the production token.

Idempotency-Key is optional. Without a key, the same amount must wait 24 hours and a different amount must wait 2 hours. A new key removes both waits. Sending the same key again is a retry of the original payment.

1. Payment Initiation setup

The agreement must be active and must belong to the merchant for the token you send. In the sandbox, get a bearer token, then create the payment. The sandbox base URL is https://dev-api.shabaas.com.

amount is required. Send a positive number with at most two decimal places, such as 10.00. notes is optional.

Without an idempotency key

POST /api/public/payment_initiation HTTP/1.1
Host: dev-api.shabaas.com
Authorization: Bearer <sandbox_token>
Content-Type: application/json
{
  "payment_initiation": {
    "payment_agreement_id": "3652PA20260408123221550",
    "amount": "10.00",
    "notes": "Invoice 1042"
  }
}

ShaBaas creates the payment and returns HTTP 200.

{
  "message": "Success",
  "data": {
    "payment_initiation_id": "12345PI1714316400",
    "settled": false,
    "status": "accp",
    "transfer": null,
    "created_at": "2026-04-28T13:45:00.000Z",
    "amount": "10.00",
    "currency": "AUD",
    "state_version": 1,
    "operation_id": null,
    "merchant_reference": null
  }
}

A second request for the same agreement, destination and amount is rejected with R804 for 24 hours. A different amount is rejected for 2 hours. Wait until that lock expires, then retry. Save payment_initiation_id and look the payment up instead of starting another debit for the same invoice.

If the bank times out and you did not send a key, the response is HTTP 200 with the R805 message and status accp. Poll the payment until it reaches a final status.

With an idempotency key

A new key removes the 24 hour wait for the same amount and the 2 hour wait for a different amount. The payment starts now. That request does not return R804.

Use the same key and the same body only to retry. A retry does not take the money again.

The key is 16 to 128 characters: letters, numbers, ., _, : and -. Keep it with the invoice.

merchant_reference is optional, up to 128 characters. You can use the same reference again with a new key. If the account is set to require a key, merchant_reference is required too.

POST /api/public/payment_initiation HTTP/1.1
Host: dev-api.shabaas.com
Authorization: Bearer <sandbox_token>
Content-Type: application/json
Idempotency-Key: payment-invoice-4201-v1
{
  "payment_initiation": {
    "payment_agreement_id": "3652PA20260408123221550",
    "amount": "50.00",
    "merchant_reference": "invoice-4201",
    "notes": "Invoice 4201"
  }
}

A created payment still returns HTTP 200. operation_id and merchant_reference are present because the request included a key.

{
  "message": "Success",
  "data": {
    "payment_initiation_id": "12345PI1714316400",
    "settled": false,
    "status": "accp",
    "transfer": null,
    "created_at": "2026-04-28T13:45:00.000Z",
    "amount": "50.00",
    "currency": "AUD",
    "state_version": 1,
    "operation_id": "op_2f1c0c4e-7b2a-4d3e-9a11-6c5b2a1d0e44",
    "merchant_reference": "invoice-4201"
  }
}
ResultWhat ShaBaas does
Same key, same bodyReturns the original response. Idempotency-Replayed: true means this call did not debit the payer again.
Same key, different bodyHTTP 409, idempotency_conflict. Repeat the original body, or send a new key for a new payment.
Same key, result not stored yetHTTP 202 and Retry-After: 5. Repeat the same key and body. Do not create a new payment.
New keyRemoves the 24 hour wait for the same amount and the 2 hour wait for a different amount. The payment starts now.

A new key does not remove the daily amount limit or the limit of 10 payments per Sydney day.

A bank timeout on a keyed request returns HTTP 202. The payment stays initiated. Repeat the same key. Do not treat that response as a completed debit.

{
  "message": "Payment outcome pending; retrieve the original operation",
  "data": {
    "payment_initiation_id": "12345PI1714316400",
    "amount": "50.00",
    "currency": "AUD",
    "settled": false,
    "status": "initiated",
    "operation_id": "op_2f1c0c4e-7b2a-4d3e-9a11-6c5b2a1d0e44",
    "merchant_reference": "invoice-4201",
    "state_version": 1,
    "created_at": "2026-04-28T13:45:00.000Z"
  }
}

Before a payment id exists, the 202 body names the operation and says not to create a new payment. Wait 5 seconds, then send the same request.

2. Store the response

Save payment_initiation_id against the invoice. Payer funds have cleared when status is acsc and settled is true. transfer is the later payout to the business bank account. transfer_not_started means that payout has not started. transferred means it has been sent.

Store operation_id and merchant_reference when the request included a key. operation_id is null when the request had no key.

Retrieve the payment whenever you need the latest status, including refunds. After production access is approved, repeat the same calls against https://api.shabaas.com.

3. Status values

These are the status values returned on create and get payment initiation, and on payment-initiation webhooks. Compare them without case sensitivity.

Payer funds have cleared when status is ACSC and settled is true. Bank payout is a separate field: transfer = transferred.

StatusMeaning
INITIATEDPayment request created
ACCPAccepted
ACSPSettlement in process
INPRIn progress
SAFDStored, awaiting funds
SENTSent
UNDVUndeliverable
ACSCSettlement completed (payer money cleared)
RJCTRejected
FAILEDFailed
RETURN_IN_PROGRESSRefund in progress
RETURN_FAILEDRefund failed
RETURN_COMPLETERefund completed
INVOICEInvoice created, not yet paid
FieldValueMeaning
settledtruePayer money has cleared into the ledger
transfertransferredPayout sent to the merchant bank
← Back to API Reference