# 20. 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>](https://developer.paywall.one/payment-orchestration-integration-document/environment)
{% endhint %}

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

<table><thead><tr><th width="162">Parameter</th><th width="79">Type</th><th width="107">Required</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": "{{externalReference}}",
  "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
{
    "Value": {
        "Id": "01034c7e-a1b8-4ca5-827e-583cb4385b54",
        "WalletId": "30bac1c0-ad6b-4c50-a52e-1b34f9b487a7",
        "TransactionType": "Refund",
        "Amount": 1.00,
        "GiftAmount": null,
        "Description": "Refund of Purchase Jeannette Nolan",
        "ExternalReference": "Jeannette Nolan",
        "CreatedAt": "2025-04-28T13:46:52.6109788Z",
        "UpdatedAt": null,
        "BalanceAfterTransaction": 994.00,
        "SourceWalletId": null,
        "DestinationWalletId": null,
        "GiftBalanceId": null,
        "MainTransactionId": "2d2eba9b-f8a9-4482-8df3-2906b9577c6e",
        "UniqueCode": "97d9b40b-7d74-4279-8bb1-db9efd73c73d",
        "UsedGiftBalances": null,
        "CashbackAmount": 0
    },
    "Errors": [],
    "IsSuccess": true,
    "IsFailure": false
}
```

{% 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>
