# Refund Payment

This endpoint processes refunds for purchases through Zotlo. It allows you to issue refunds for any payment processed by Zotlo, including one-time purchases, subscriptions.

Use the **POST** method to create a refund. You must provide the `transactionId` of the original payment.

<table data-header-hidden><thead><tr><th width="99.640625"></th><th></th></tr></thead><tbody><tr><td>Method</td><td><h4>  <mark style="color:blue;"><code>POST</code></mark></h4></td></tr><tr><td>URL</td><td><pre data-overflow="wrap" data-full-width="false"><code>https://api.zotlo.com/v1/payment/refund
</code></pre></td></tr></tbody></table>

## **Request Parameters**

<table><thead><tr><th width="176.16015625">Field</th><th width="115.48828125">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>transactionId</code></td><td>Required</td><td>The ID of the transaction to refund.</td></tr><tr><td><code>refundReason</code></td><td>Required</td><td>Explanation or reason for the refund.</td></tr><tr><td><code>refundUser</code></td><td>Optional</td><td>Who initiated the refund. Can be any descriptive string (e.g., “API”, “Support Agent”, “System Rule”).</td></tr></tbody></table>

## **Sample Request**

{% code overflow="wrap" %}

```js
POST https://api.zotlo.com/v1/payment/refund HTTP/1.1
AccessKey: ••••••
AccessSecret: ••••••
Content-Type: application/json
ApplicationId: •
Language: ••
{
    "transactionId": "0741a0ac-21d8-4750-941f-064f340700c3",
    "refundReason": "User request!"
}
```

{% endcode %}

{% hint style="info" %}
You can find your **AccessKey** and **AccessSecret** in the Zotlo Panel under **Developer Tools → API Keys**

Sending **ApplicationId** is optional.
{% endhint %}

## Successful Response

{% code overflow="wrap" %}

```json
{
  "meta": {
    "requestId": "246a8e676214-REQ-659557ea5289c",
    "httpStatus": 200
  },
  "result": {
    "providerResponse": [],
    "transaction": {
      "id": 57333,
      "payment_type": "subscription",
      "original_transaction_id": "d8ff7792-1c63-4370-be93-447dacaa09ea",
      "transaction_id": "0741a0ac-21d8-4750-941f-064f340700c3",
      "package_id": "premium",
      "team_id": 5,
      "app_id": 5,
      "status": "renewal",
      "create_date": "2024-01-03 12:47:20",
      "purchase_date": "2024-01-03 12:47:20",
      "original_purchase_date": "2023-01-03 12:47:16",
      "price": "12.00",
      "currency": "TRY",
      "country": "TR",
      "expire_date": "2025-01-03 12:47:16",
      "subscriber_id": "905456757656",
      "credit_card": "11111111****4111",
      "refund_price": "5.00",
      "refund_date": "2024-01-03 12:49:46",
      "refund_reason": "{\"reason\":\"Test .\",\"user\":\"API:\"}",
      "is_refund": 1,
      "provider_id": 8,
      "provider_transaction_id": "e963981a-4ee1-494b-b1e8-73db2a694c58",
      "provider_status": "unknown",
      "provider_name": "Zotlo",
      "quantity": 1,
      "package_price": "12.00",
      "subscription_id": 5370
    },
    "refundHistory": [
      {
        "id": 3627,
        "team_id": 5,
        "app_id": 5,
        "provider_id": 8,
        "package_id": "premium",
        "subscriber_id": "905456757656",
        "transaction_id": "0741a0ac-21d8-4750-941f-064f340700c3",
        "country": "TR",
        "price": "5.00",
        "currency": "TRY",
        "reason": "{\"reason\":\"Test .\",\"user\":\"API:\"}",
        "refund_date": "2024-01-03 12:49:46"
      }
    ]
  }
}
```

{% endcode %}

## Key **Response Fields**

<table><thead><tr><th width="184.015625">Field</th><th>Description</th></tr></thead><tbody><tr><td>providerResponse</td><td>Raw response returned by the payment provider during the refund.</td></tr><tr><td>transaction</td><td>Updated transaction record after the refund. Contains refund amount, refund date, status, and provider information.</td></tr><tr><td>refundHistory</td><td>List of all refunds issued for this transaction (useful for partial or multiple refunds).</td></tr></tbody></table>

## **Failed Response**

All failed responses follow the same standard error format.\
(See: [**Error Handling**](https://docs.zotlo.com/integrating-zotlo/api-reference/error-handling))
