> For the complete documentation index, see [llms.txt](https://developer.paywall.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.paywall.one/payment-orchestration-integration-document/wallet-services/2.-wallet/21.-sale-expense-refund.md).

# 21. Sale/Expense Refund

## Initiate Purchase Refund

<mark style="color:yellow;">`POST`</mark>`{{WalletUrl}}/api/v1/wallet/purchase/refund`&#x20;

{% hint style="info" %}
**Note**: To use this service, it is mandatory to include the apikeypublic and apiclientpublic parameters in the Header field.

\
[<mark style="color:green;">**WalletAPI Address**</mark>](/payment-orchestration-integration-document/environment.md)
{% endhint %}

**The parameters that need to be sent to the service are as follows:**

<table><thead><tr><th width="162">Parameter</th><th width="117.1875">Type</th><th width="146.7890625">Compolsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>It is the general key information required for system access.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>It is the general identity information of the client accessing the service.</td></tr></tbody></table>

{% tabs %}
{% tab title="Service Reguest - JSON" %}

```json
{
  "ExternalReference": "bea70a60-c631-4c3e-963a-6188ef449601",
  "RollbackFee": true,
  "RollbackCashback": true
}
```

{% endtab %}
{% endtabs %}

## Service Request

<table><thead><tr><th width="192">Parameter</th><th width="147.89192708333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>ExternalReference</td><td>string</td><td>The tracking number for the sale/expense transaction. It is the value provided by you at the time the transaction occurs.</td></tr><tr><td>RollbackFee</td><td>bool</td><td>Should the commissions applied (<mark style="color:blue;">if any</mark>) be reversed as a result of the transaction?</td></tr><tr><td>RollbackCashback</td><td>bool</td><td>Should the cashback applied (<mark style="color:blue;">if any</mark>) be reversed as a result of the transaction?</td></tr></tbody></table>

{% tabs %}
{% tab title="Service Reguest - JSON" %}
{% code lineNumbers="true" %}

```json
{
    "IsSuccess": true,
    "IsFailure": false,
    "Value": {
        "Id": "c7cbc07d-1241-4e15-9717-4dcd844c5e82",
        "WalletId": "7883fb19-2359-4a9b-b917-f08a259898ed",
        "Alias": "2816220769",
        "TransactionType": "Refund",
        "Amount": 100.00,
        "GiftAmount": null,
        "Description": "Refund of Purchase bea70a60-c631-4c3e-963a-6188ef449601",
        "ExternalReference": "bea70a60-c631-4c3e-963a-6188ef449601",
        "CreatedAt": "2025-08-20T11:58:38.6516191Z",
        "UpdatedAt": null,
        "BalanceAfterTransaction": 99901.80,
        "SourceWalletId": null,
        "DestinationWalletId": null,
        "GiftBalanceId": null,
        "MainTransactionId": "f6f2fc96-8df1-4674-8b71-0cec7cdaa312",
        "UniqueCode": "48d3f9b5-3bd4-4393-8b64-935ec0009fd8",
        "UsedGiftBalances": null,
        "CashbackAmount": 0
    }
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Service Response

<table><thead><tr><th width="192">Parameter</th><th width="147.89192708333331">Type</th><th>Description</th></tr></thead><tbody><tr><td>IsFailure</td><td>bool</td><td>Indicates whether the transaction has failed or not. (true: failed, false: successful)</td></tr><tr><td>IsSuccess</td><td>bool</td><td>Indicates whether the transaction was successful or not. (true: successful, false: failed)</td></tr><tr><td>Errors</td><td>Array</td><td>It is the list of error messages encountered during the transaction.</td></tr><tr><td>Value</td><td>Array&#x3C;Items></td><td>It is the list of data returned as a result of the transaction.</td></tr></tbody></table>

## Service Response (Value)

<table><thead><tr><th width="234.05859375">Parameter</th><th width="162.38671875">Type</th><th width="348.94140625">Description</th></tr></thead><tbody><tr><td>Id</td><td>Guid</td><td>It is the unique identifier assigned by the system to the transaction.</td></tr><tr><td>WalletId</td><td>String</td><td>It is the identity information of the wallet that performed the transaction.</td></tr><tr><td>TransactionType</td><td>String</td><td>Specifies the type of the transaction performed. (e.g., payment, refund)</td></tr><tr><td>Amount</td><td>Decimal</td><td>The total amount used in the transaction.</td></tr><tr><td>GiftAmount</td><td>Decimal</td><td>The amount used from the gift balance in the transaction</td></tr><tr><td>Description</td><td>String</td><td>Explanatory information related to the transaction</td></tr><tr><td>ExternalReference</td><td>String</td><td>The reference code given to the transaction by an external system</td></tr><tr><td>CreatedAt</td><td>DateTime</td><td>The date and time when the transaction was created</td></tr><tr><td>UpdatedAt</td><td>DateTime</td><td>The date and time when the transaction record was last updated</td></tr><tr><td>BalanceAfterTransaction</td><td>Decimal</td><td>The total balance of the wallet after the transaction</td></tr><tr><td>SourceWalletId</td><td>String</td><td>The identity of the wallet that initiated the transaction</td></tr><tr><td>DestinationWalletId</td><td>String</td><td>The identity of the wallet to which the transaction was sent</td></tr><tr><td>GiftBalanceId</td><td>Guid</td><td>The unique identifier of the gift balance used in the transaction</td></tr><tr><td>MainTransactionId</td><td>Guid</td><td>The identifier of the associated parent transaction</td></tr><tr><td>UniqueCode</td><td>String</td><td>A unique code specifically created for the transaction</td></tr><tr><td>UsedGiftBalances</td><td>List</td><td>The list of details of the gift balances used in the transaction</td></tr><tr><td>CashbackAmount</td><td>Decimal</td><td>It is the cashback (refund) amount earned as a result of the transaction.</td></tr></tbody></table>
