# 19. Sale/Expense (Alias)

## Sale/Expense with Wallet 'Alias'

<mark style="color:yellow;">`POST`</mark>`{{WalletUrl}}/api/v1/wallet/purchase/by/alias`&#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="101.6328125">Type</th><th width="128.01953125">Compulsory</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 used for API access.</td></tr><tr><td>apiclientpublic</td><td>string</td><td>Yes</td><td>It is the general client key information that identifies the relevant client in the system.</td></tr></tbody></table>

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

```json
{
  "Alias": "2816220769",
  "Amount": 10,
  "Description": "string",
  "ExternalReference": "{{$randomFullName}}",
  "UseGiftBalances": true, // If there is a defined gift balance, it will be spent first.
  "CashbackApply": true,
  "CashbackType": "Amount",
  "CashbackValue": 10
}
```

{% 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>Alias</td><td>string</td><td>The wallet number where the sale/expense transaction took place.</td></tr><tr><td>Amount</td><td>decimal</td><td>The transaction amount.</td></tr><tr><td>Description</td><td>string</td><td>The description of the transaction.</td></tr><tr><td>ExternalReference</td><td>string</td><td>The transaction tracking number.</td></tr><tr><td>UseGiftBalance</td><td>bool</td><td>If there is a gift balance assigned to the wallet where the transaction occurred, 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>The cashback value to be given.</td></tr></tbody></table>

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

```json
{
    "IsSuccess": true,
    "IsFailure": false,
    "Value": {
        "Id": "24d912c2-11b1-4fdf-b0e7-6483e526e523",
        "WalletId": "7883fb19-2359-4a9b-b917-f08a259898ed",
        "Alias": "2816220769",
        "TransactionType": "Purchase",
        "Amount": 10,
        "GiftAmount": null,
        "Description": "string",
        "ExternalReference": "6ddf4d59-34f9-447a-9168-c1846bdb5d79",
        "CreatedAt": "2025-08-20T11:56:51.8211279Z",
        "UpdatedAt": null,
        "BalanceAfterTransaction": 99892.80,
        "SourceWalletId": null,
        "DestinationWalletId": null,
        "GiftBalanceId": null,
        "MainTransactionId": null,
        "UniqueCode": "e7022bed-3827-44f4-a1fe-c035048298df",
        "UsedGiftBalances": null,
        "CashbackAmount": 1.00
    }
}
```

{% endcode %}
{% 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>IsFailure</td><td>bool</td><td>It returns true if the service request failed, otherwise false.</td></tr><tr><td>IsSuccess</td><td>bool</td><td>It returns true if the service request was successful, otherwise false.</td></tr><tr><td>Errors</td><td>Array</td><td>It is the list of messages or error codes returned in case of an error.</td></tr><tr><td>Value</td><td>Array&#x3C;Items></td><td>It is the main list containing the data returned from the service.</td></tr></tbody></table>

## Service Request (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 of the transaction.</td></tr><tr><td>WalletId</td><td>String</td><td>It is the identity of the wallet where the transaction took place.</td></tr><tr><td>TransactionType</td><td>String</td><td>It specifies the type of the transaction (e.g., payment, refund, transfer).</td></tr><tr><td>Amount</td><td>Decimal</td><td>It specifies the total amount used in the transaction.</td></tr><tr><td>GiftAmount</td><td>Decimal</td><td>It is the amount used from the gift balance.</td></tr><tr><td>Description</td><td>String</td><td>It is the explanatory information related to the transaction.</td></tr><tr><td>ExternalReference</td><td>String</td><td>It is the reference information provided 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 time of the last update made to the transaction.</td></tr><tr><td>BalanceAfterTransaction</td><td>Decimal</td><td>The new balance of the wallet after the transaction.</td></tr><tr><td>SourceWalletId</td><td>String</td><td>Source wallet ID (used in transfer transactions).</td></tr><tr><td>DestinationWalletId</td><td>String</td><td>Target wallet ID (used in transfer transactions).</td></tr><tr><td>GiftBalanceId</td><td>Guid</td><td>It is the identifier of the used gift balance.</td></tr><tr><td>MainTransactionId</td><td>Guid</td><td>It is the ID of the parent transaction (used as a reference in related transactions).</td></tr><tr><td>UniqueCode</td><td>String</td><td>It is the unique code specific to the transaction.</td></tr><tr><td>UsedGiftBalances</td><td>List</td><td>It is the list of gift balances used in the transaction.</td></tr><tr><td>CashbackAmount</td><td>Decimal</td><td>It is the cashback amount earned as a result of this transaction.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.paywall.one/payment-orchestration-integration-document/wallet-services/2.-wallet/19.-sale-expense-alias.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
