Skip to content

refundPayment

Request a full or partial refund for a completed payment.

Request

POST /api/v2/refundPayment

Headers

Header Required Description
token Yes Your API Key
Content-Type Yes application/json

Body Parameters

Field Type Required Description
pay_id integer Yes The linktopay_id of the payment to refund
refund_amount number Yes Amount to refund in EUR
isFullRefund boolean No Set to true for full refund (still requires refund_amount)

refund_amount is required

The refund_amount field is always required — even for full refunds. Set it to the full payment amount when doing a complete refund.

Response

Success (ResponseCode: 1)

{
  "ResponseCode": 1,
  "ResponseMsg": "Refund request has been sent successfully, You will get update within 5-10 days",
  "Result": "True",
  "ServerTime": "CEST"
}

Error (ResponseCode: 0)

{
  "ResponseCode": 0,
  "ResponseMsg": "Please enter refund_amount",
  "Result": "False",
  "ServerTime": "CEST"
}
ResponseMsg Cause
Please enter pay_id Missing pay_id field
Please enter refund_amount Missing refund_amount field
Invalid link ID Link not found or belongs to another user
Link is cancelled Cannot refund a cancelled (unpaid) link
Refund already requested A refund was already submitted for this link
Refund blocked by dispute An active dispute prevents refunding
Invalid refund amount Amount exceeds original payment or is ≤ 0

Examples

curl -X POST https://app.secpaid.com/api/v2/refundPayment \
  -H "Content-Type: application/json" \
  -H "token: YOUR_API_KEY" \
  -d '{
    "pay_id": 12345,
    "refund_amount": 49.99,
    "isFullRefund": true
  }'
curl -X POST https://app.secpaid.com/api/v2/refundPayment \
  -H "Content-Type: application/json" \
  -H "token: YOUR_API_KEY" \
  -d '{
    "pay_id": 12345,
    "refund_amount": 20.00
  }'
const response = await fetch("https://app.secpaid.com/api/v2/refundPayment", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "token": "YOUR_API_KEY"
  },
  body: JSON.stringify({
    pay_id: 12345,
    refund_amount: 20.00
  })
});
$response = Http::withHeaders([
    'token' => 'YOUR_API_KEY',
])->post('https://app.secpaid.com/api/v2/refundPayment', [
    'pay_id' => 12345,
    'refund_amount' => 20.00,
]);

Process

  1. You submit the refund request via API
  2. The request enters a pending state for admin review
  3. A SecPaid admin approves or rejects the refund
  4. If approved, the refund is processed to the customer's original payment method

Not instant

Refunds are not processed immediately. They require admin approval. The API call creates a refund request, not an immediate refund.

Notes

  • Only one refund request per payment link is allowed
  • Refund amount cannot exceed the original payment amount
  • No webhook notification is sent when refunds are processed
  • Refunds go back to the customer's original payment method
  • See Refunds concept for the full lifecycle