> 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/18.-sale-expense-wallet.md).

# 18. Sale/Expense (Wallet)

## Sale/Expense with Wallet 'Id'

<mark style="color:yellow;">`POST`</mark>`{{WalletUrl}}/api/v1/Wallet/purchase`&#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="112.6640625">Type</th><th width="140.3671875">Compulsory</th><th width="403">Description</th></tr></thead><tbody><tr><td>apikeypublic</td><td>string</td><td>Yes</td><td>The general key used for API access.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>The general key representing the API client ID.</td></tr></tbody></table>

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

```json
{
  "Id": "92858707-7718-435c-9ba3-3d702a3bea9b",
  "Amount": 1,
  "Description": "string",
  "ExternalReference": "{{$guid}}",
  "UseGiftBalances": false,
  "CashbackApply": false,
  "CashbackType": "Percentage",
  "CashbackValue": 50
}
```

{% 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>Id</td><td>Guid</td><td>Identifier of the wallet where the sale/expense transaction is performed</td></tr><tr><td>Amount</td><td>decimal</td><td>Transaction amount</td></tr><tr><td>Description</td><td>string</td><td>Description of the transaction</td></tr><tr><td>ExternalReference</td><td>string</td><td>Transaction tracking number</td></tr><tr><td>UseGiftBalance</td><td>bool</td><td>If there is a defined bonus balance in the wallet where the transaction is performed, should this balance be used?</td></tr><tr><td>CashbackApply</td><td>bool</td><td>Should cashback be applied after the transaction?</td></tr><tr><td>CashbackType</td><td>string</td><td>Cashback type<br><br>See: <a href="/pages/sKlLDRa10aojPQk2SmGf">Cashback Types</a></td></tr><tr><td>CashbackValue</td><td>decimal</td><td>Cashback amount to be granted</td></tr></tbody></table>

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

```json
{
    "IsSuccess": true,
    "IsFailure": false,
    "Value": {
        "Id": "784f8d50-c2cc-4911-b82b-2f8f49a0b98f",
        "WalletId": "7883fb19-2359-4a9b-b917-f08a259898ed",
        "Alias": "2816220769",
        "TransactionType": "Purchase",
        "Amount": 100,
        "GiftAmount": null,
        "Description": "string",
        "ExternalReference": "8e0c7f38-d63e-4c79-b6e6-c53751d205cf",
        "CreatedAt": "2025-08-20T11:56:24.8210569Z",
        "UpdatedAt": null,
        "BalanceAfterTransaction": 99900.80,
        "SourceWalletId": null,
        "DestinationWalletId": null,
        "GiftBalanceId": null,
        "MainTransactionId": null,
        "UniqueCode": "bd0413e8-2a5f-4476-8617-57775655e322",
        "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>It returns true if the transaction failed, otherwise false.</td></tr><tr><td>IsSuccess</td><td>bool</td><td>It returns true if the transaction was successful, otherwise false.</td></tr><tr><td>Errors</td><td>Array</td><td>A list of error messages.</td></tr><tr><td>Value</td><td>Array&#x3C;Items></td><td>The data set 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 generated by the system for the transaction. It is in UUID format.</td></tr><tr><td>WalletId</td><td>String</td><td>It is the system identifier of the wallet where the transaction took place. It indicates which wallet the transaction is associated with.</td></tr><tr><td>TransactionType</td><td>String</td><td>It specifies the type of the transaction. For example, it defines transactions such as "Payment," "Refund," or "Transfer."</td></tr><tr><td>Amount</td><td>Decimal</td><td>It is the amount of the transaction, expressed in the currency used.</td></tr><tr><td>GiftAmount</td><td>Decimal</td><td>It is the amount of gift balance used in the transaction. Unlike the regular balance, it represents promotional usage.</td></tr><tr><td>Description</td><td>String</td><td>It is the explanatory information related to the transaction. It can be written by the user or the system.</td></tr><tr><td>ExternalReference</td><td>String</td><td>It is the reference number provided by an external system for the transaction. It is typically used for integration systems.</td></tr><tr><td>CreatedAt</td><td>DateTime</td><td>It is the date and time when the transaction was created. It is recorded according to UTC or the system time.</td></tr><tr><td>UpdatedAt</td><td>DateTime</td><td>It is the date and time when the transaction was last updated. It is updated whenever a change occurs.</td></tr><tr><td>BalanceAfterTransaction</td><td>Decimal</td><td>It is the remaining balance in the wallet after the transaction. It represents the value after account updates.</td></tr><tr><td>SourceWalletId</td><td>String</td><td>It is the ID of the wallet on the sender's side of the transaction. It specifies the wallet from which the money is being withdrawn.</td></tr><tr><td>DestinationWalletId</td><td>String</td><td>It is the ID of the wallet on the recipient's side of the transaction. It specifies the wallet into which the money is being deposited.</td></tr><tr><td>GiftBalanceId</td><td>Guid</td><td>It is the unique identifier for the used gift balance. It is for tracking purposes.</td></tr><tr><td>MainTransactionId</td><td>Guid</td><td>If this transaction is a continuation or part of another transaction, it is the ID of the parent transaction.</td></tr><tr><td>UniqueCode</td><td>String</td><td>It is the unique code generated by the system for the transaction. It guarantees its uniqueness.</td></tr><tr><td>UsedGiftBalances</td><td>List</td><td>It is the list of gift balances used in the transaction. Multiple balances can be used.</td></tr><tr><td>CashbackAmount</td><td>Decimal</td><td>It is the cashback amount earned as a result of the transaction. It is sourced from a campaign or promotion.</td></tr></tbody></table>
