# 18. 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>](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 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": "{{alias}}",
  "Amount": 1,
  "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="broken-reference">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
{
    "Value": {
        "Id": "e966d7fe-4d49-4b73-9c58-0921cfa51ea3",
        "WalletId": "30bac1c0-ad6b-4c50-a52e-1b34f9b487a7",
        "TransactionType": "Purchase",
        "Amount": 1,
        "GiftAmount": null,
        "Description": "string",
        "ExternalReference": "Casey Padberg",
        "CreatedAt": "2025-04-28T08:10:12.8828523Z",
        "UpdatedAt": null,
        "BalanceAfterTransaction": 984.00,
        "SourceWalletId": null,
        "DestinationWalletId": null,
        "GiftBalanceId": null,
        "MainTransactionId": null,
        "UniqueCode": "7006528f-c704-4aa5-b7ac-df84389059f6",
        "UsedGiftBalances": null,
        "CashbackAmount": 10
    },
    "Errors": [],
    "IsSuccess": true,
    "IsFailure": false
}
```

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