# Get Transaction By ID

<mark style="color:green;">`POST`</mark> `/` `auth/view-transaction`

The request should include the transaction code in the raw request body.

**Headers**

| Name         | Value              |
| ------------ | ------------------ |
| Content-Type | `application/json` |
| Token        | `<token>`          |

**Body**

<table><thead><tr><th width="223">Name</th><th width="192">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>transaction_code</code></td><td>string</td><td>The Transaction Code of the transaction to be viewed.</td></tr><tr><td><code>payment_reference</code></td><td>string</td><td>A reference unique to your system</td></tr></tbody></table>

{% hint style="info" %}
For the body of the request above, you can either use `transaction_code`  or `payment_reference`  to query the transaction
{% endhint %}

**Response**

{% tabs %}
{% tab title="cURL" %}

```json
curl --location 'http://sandbox.yogupay.com/auth/view-transaction' \
--header 'token: [Generated after login]' \
--data '{
  "transaction_code": "ECQ14Y4PQS"
}'
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "status": 0,
    "transaction": {
        "id": 6537,
        "transaction_code": "ECQ14Y4PQS",
        "transaction_type": "MOBILE MONEY",
        "transaction_source_currency_code": "KES",
        "source_amount": 50,
        "transaction_destination_currency_code": "KES",
        "destination_amount": 50,
        "transaction_charge": 0,
        "total_amount_charged": 50,
        "recipient_msisdn": 254702423791,
        "recipient_bank_account": "",
        "recipient_bank_code": "",
        "recipient_email": "johndoe@yogupay.com",
        "recipient_name": "John Doe",
        "sender_narrative": "Payment",
        "created_at": "2024-11-04T14:06:23.000Z",
        "payment_reference": "qwerty543123452",
        "status": 2
    },
    "transaction_status": "Successful"
}

```

{% endtab %}
{% endtabs %}


---

# 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://yogupay.gitbook.io/yogupay-payout-api/payouts/get-transaction-by-id.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.
