PlexySDK DOCS

Refund Payments

Learn how to refund captured payments and return funds to customers

Refund Payments

A refund returns funds to the customer after a payment has been captured and settled. Use refunds for returns, cancellations after settlement, or when adjusting the final amount owed.

When to Refund

Refund a payment when:

  • Customer returns a product
  • Service was not delivered as expected
  • Customer was overcharged
  • Order was cancelled after payment settled
  • Goodwill gesture or customer satisfaction

For payments that haven't settled yet, use reversal instead. Reversals are faster and avoid interchange fees.

API Endpoint

POST https://api.plexypay.com/v2/payments/{payment_id}/refunds

Refunding a Payment

Full Refund

Refund the entire captured amount:

curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "merchant_id": "merchant_abc123",
    "reason": "CUSTOMER_REQUEST"
  }'

Request Parameters

ParameterTypeRequiredDescription
amountobjectNoAmount to refund. If omitted, refunds the full captured amount.
amount.valueintegerYesAmount in smallest currency unit
amount.currencystringYesThree-letter ISO currency code
merchant_idstringYesYour merchant identifier
reasonstringYesReason code for the refund
referencestringNoYour internal reference for this refund
descriptionstringNoAdditional details about the refund
idempotency_keystringNoUnique key to prevent duplicate refunds

Refund Reasons

You must provide a reason code for each refund:

Reason CodeDescriptionUse Case
FRAUDFraudulent transactionUnauthorized use, stolen card
CUSTOMER_REQUESTCustomer asked for refundGeneral cancellation, changed mind
RETURNProduct returnedPhysical goods returned
DUPLICATEDuplicate transactionAccidental double charge
OTHEROther reasonSpecify in description field

Response

{
  "payment_id": "pay_1234567890",
  "refund_id": "ref_0987654321",
  "status": "refunded",
  "merchant_id": "merchant_abc123",
  "amount": {
    "value": 10000,
    "currency": "KZT"
  },
  "reason": "CUSTOMER_REQUEST",
  "refunded_at": "2026-03-25T10:30:00Z"
}

Partial Refunds

Refund a portion of the captured amount:

curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 3000,
      "currency": "KZT"
    },
    "merchant_id": "merchant_abc123",
    "reason": "RETURN",
    "description": "Partial refund for returned item"
  }'

Partial Refund Response

{
  "payment_id": "pay_1234567890",
  "refund_id": "ref_0987654321",
  "status": "refunded",
  "merchant_id": "merchant_abc123",
  "amount": {
    "value": 3000,
    "currency": "KZT"
  },
  "remaining_captured": {
    "value": 7000,
    "currency": "KZT"
  },
  "reason": "RETURN",
  "refunded_at": "2026-03-25T10:30:00Z"
}

Multiple Refunds

You can issue multiple partial refunds for the same payment until the total captured amount is refunded.

First refund — return item 1:

curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 3000, "currency": "KZT" },
    "merchant_id": "merchant_abc123",
    "reason": "RETURN",
    "reference": "return_item_1"
  }'

Second refund — return item 2:

curl -X POST https://api.plexypay.com/v2/payments/pay_1234567890/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": { "value": 2000, "currency": "KZT" },
    "merchant_id": "merchant_abc123",
    "reason": "RETURN",
    "reference": "return_item_2"
  }'

To check the remaining refundable amount, retrieve the payment:

curl -X GET https://api.plexypay.com/v2/payments/pay_1234567890 \
  -H "x-api-key: YOUR_API_KEY"

The response includes refundable_amount — in this example, 5000 (original 10000 − 3000 − 2000).

Unreferenced Refunds

In some cases, you may need to refund a customer without a matching original payment (e.g., cash payment refunded to card, compensation). This is called an unreferenced refund.

Unreferenced refunds have higher fraud risk and may require additional verification. Use them only when necessary.

curl -X POST https://api.plexypay.com/v2/refunds \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": {
      "value": 5000,
      "currency": "KZT"
    },
    "merchant_id": "merchant_abc123",
    "payment_method": {
      "type": "card",
      "card_number": "4111111111111111",
      "expiry_month": "12",
      "expiry_year": "2028"
    },
    "reason": "OTHER",
    "description": "Compensation for service issue"
  }'

Webhook Events

REFUND

Sent when a refund is successfully processed.

{
  "event_type": "REFUND",
  "event_id": "evt_abc123",
  "created_at": "2026-03-25T10:30:00Z",
  "data": {
    "payment_id": "pay_1234567890",
    "refund_id": "ref_0987654321",
    "merchant_id": "merchant_abc123",
    "amount": {
      "value": 10000,
      "currency": "KZT"
    },
    "reason": "CUSTOMER_REQUEST",
    "status": "refunded",
    "refunded_at": "2026-03-25T10:30:00Z"
  }
}

REFUND_FAILED

Sent when a refund attempt fails.

{
  "event_type": "REFUND_FAILED",
  "event_id": "evt_def456",
  "created_at": "2026-03-25T10:30:00Z",
  "data": {
    "payment_id": "pay_1234567890",
    "merchant_id": "merchant_abc123",
    "amount": {
      "value": 10000,
      "currency": "KZT"
    },
    "error": {
      "code": "INSUFFICIENT_BALANCE",
      "message": "Merchant account has insufficient balance to process refund"
    }
  }
}

REFUND_REVERSED

Sent when a refund is reversed (e.g., funds returned to merchant because customer account was closed).

{
  "event_type": "REFUND_REVERSED",
  "event_id": "evt_ghi789",
  "created_at": "2026-03-25T10:30:00Z",
  "data": {
    "payment_id": "pay_1234567890",
    "refund_id": "ref_0987654321",
    "merchant_id": "merchant_abc123",
    "amount": {
      "value": 10000,
      "currency": "KZT"
    },
    "reversal_reason": "Customer account closed",
    "reversed_at": "2026-03-25T10:30:00Z"
  }
}

Refund Processing Time

Refund timing varies by payment method:

Payment MethodProcessing Time
Visa/Mastercard5-10 business days
Bank transfer1-3 business days
E-walletsInstant to 24 hours

Even after Plexy processes the refund, it may take additional time for the customer's bank to credit their account.

Error Handling

Error CodeDescriptionResolution
PAYMENT_NOT_FOUNDPayment ID does not existVerify the payment_id
INVALID_PAYMENT_STATEPayment not in refundable stateCheck payment status
AMOUNT_EXCEEDS_CAPTUREDRefund amount exceeds captured amountReduce refund amount
INSUFFICIENT_BALANCEMerchant balance too lowAdd funds to merchant account
REFUND_NOT_SUPPORTEDPayment method doesn't support refundsContact customer for alternative
REFUND_WINDOW_EXPIREDToo much time since captureContact support for assistance

Example Error Handling

If the refund returns AMOUNT_EXCEEDS_CAPTURED, retrieve the payment to check the remaining refundable amount:

curl -X GET https://api.plexypay.com/v2/payments/pay_1234567890 \
  -H "x-api-key: YOUR_API_KEY"

The response includes refundable_amount.value — use this as the maximum for your refund request.

If the error is INSUFFICIENT_BALANCE, alert your finance team and top up the merchant account balance before retrying.

If the error is INVALID_PAYMENT_STATE, retrieve the payment to inspect its current status field and determine the appropriate next action.

Refund vs Cancel vs Reversal

ScenarioActionTime to Customer
Payment authorized, not capturedCancelImmediate
Payment captured, before settlementReversal1-2 business days
Payment captured, after settlementRefund5-10 business days

Best Practices

If the payment hasn't settled yet, use reversal instead of refund for faster processing and lower fees.

Track refund reasons for analytics and fraud prevention.

Prevent duplicate refunds from retry attempts.

Update your order system when REFUND webhook arrives, not just on API response.

Communicate clear refund policies to customers and enforce time limits.

High refund rates may indicate product or service issues, or potential fraud.

Viewing Refunds in Plexy Dashboard

Manage refunds in the Plexy Dashboard:

  1. Navigate to Payments
  2. Filter by Status: Refunded or Partially Refunded
  3. Click on a payment to view refund history

The dashboard shows:

  • All refunds for a payment
  • Refund amounts and reasons
  • Processing status and timestamps
  • Remaining refundable amount

You can also issue refunds directly from the Dashboard:

  1. Find the payment you want to refund
  2. Click Refund
  3. Enter the amount and reason
  4. Confirm the refund

On this page