Refund a payment

POST /payment/refund

Refund all or part of a previous payment. Can be full or partial refunds.

application/json

Body Required

  • data object Required

    The actual request data to be processed

    Hide data attributes Show data attributes object
    • originalTransactionId string Required

      ID of the original transaction to refund

    • amount number Required

      Amount to refund (full amount if not specified)

    • reason string

      Reason for refund

    • description string

      Additional refund details

  • signature string Required

    ed25519 signature of the data, signed with user's private key

  • publicKey string Required

    User's derived public key for signature verification

  • timestamp integer Required

    Unix timestamp when the request was created (milliseconds)

  • nonce string Required

    Unique nonce to prevent replay attacks

Responses

  • 201 application/json

    Refund initiated successfully

    Hide response attributes Show response attributes object
    • success boolean
    • refundId string
    • originalTransactionId string
    • amount number
    • status string

      Values are pending, processing, completed, or failed.

    • timestamp string(date-time)
  • 400

    Invalid request parameters

  • 401

    Authentication failed

  • 403

    Refund not allowed

  • 404

    Original transaction not found

  • 429

    Rate limit exceeded

  • 500

    Internal server error

POST /payment/refund
curl \
 --request POST 'https://pay-api-dev.aiic.nz/v1/payment/refund' \
 --header "X-Public-Key: $API_KEY" \
 --header "Content-Type: application/json" \
 --data '{"data":{"originalTransactionId":"txn_abc123","amount":2500,"reason":"Customer requested refund","description":"string"},"signature":"base64-encoded-signature","publicKey":"base64-encoded-public-key","timestamp":1703123456789,"nonce":"abc123-def456-ghi789"}'
Request examples
{
  "data": {
    "originalTransactionId": "txn_abc123",
    "amount": 2500,
    "reason": "Customer requested refund",
    "description": "string"
  },
  "signature": "base64-encoded-signature",
  "publicKey": "base64-encoded-public-key",
  "timestamp": 1703123456789,
  "nonce": "abc123-def456-ghi789"
}
Response examples (201)
{
  "success": true,
  "refundId": "ref_xyz789",
  "originalTransactionId": "txn_abc123",
  "amount": 2500,
  "status": "pending",
  "timestamp": "2025-05-04T09:42:00Z"
}