💸 Refund API POST

Description: Initiates a full or partial refund for a previously successful transaction.

Note: Refund cannot be initiated for failed payments. Duplicate refunds are not allowed. You can only refund up to the amount received.

📍 Endpoint
https://stanzape.com/api/uat/refund/init/
🔐 Headers
Content-Type: application/json
"X-Signature: " . base64_encode(hash_hmac('sha256', $json_body, $shared_secret, true))

🌐 Cross-Language HMAC Logic

Language Core Logic
Node.js crypto.createHmac('sha256', key).update(message).digest('base64')
Python base64.b64encode(hmac.new(key, msg, hashlib.sha256).digest()).decode()
Java Base64.getEncoder().encodeToString(mac.doFinal(message.getBytes()))
PHP base64_encode(hash_hmac('sha256', $message, $key, true))
📤 Request JSON Body
{
  "orderid": "ORD2025010112562223",
  "refundid": "REF1234567890",
  "amount": 50.00,
  "reason": "Customer request",
  "merchantdata": {
    "mid": "XXXXXX02",
    "authkey": "XXXXXXXXXXXXXXstanzakey"
  }
}
✅ Success Response
{
  "status": "STANZA001",
  "message": "Refund successful",
  "refundid": "REF1234567890",
  "orderid": "ORD2025010112562223",
  "amount": 50.00,
  "timestamp": "2025-07-23T22:30:00+05:30"
}
❌ Error Response
{
  "status": "STANZA002",
  "message": "Refund not allowed for failed transaction" // or other error details
}
📟 HTTP Response Codes
StatusCodeMeaning
STANZA001Refund processed successfully
⚠️STANZA002Bad Request – Invalid or failed orderid
🔐STANZA003Unauthorized – Invalid auth key
💥STANZA004Server error – try again later

🔎 Refund Status Check API POST

Description: Check the status of a refund using the refundid.

📍 Endpoint
https://stanzape.com/api/uat/refund/status/
📤 Request JSON Body
{
  "request": {
    "refundid": "REF1234567890"
  },
  "merchantdata": {
    "mid": "XXXXXX02",
    "authkey": "XXXXXXXXXXXXXXstanzakey"
  }
}
✅ Success Response
{
  "status": "STANZA001",
  "message": "Refund Found",
  "refund": {
    "refundid": "REF1234567890",
    "orderid": "ORD2025010112562223",
    "amount": 50.00,
    "status": "REFUNDED",
    "timestamp": "2025-07-23T22:30:00+05:30"
  }
}
❌ Failure Response
{
  "status": "STANZA002",
  "message": "Refund ID not found"
}

📬 Need Help?

If you're facing issues or need integration support, Email: support@stanzape.com or connect with our team.