# Lookup using Public Key

The RKFL provides a separate API to get the latest transaction status. This API accepts "merchant\_i&#x64;*" and "transaction*\_id" as a request payload encrypted by the public RSA key and returns the response in JSON format.

```
// Object to encrypt
const toEncrypt = {
      merchantId: <merchant_id>, 
      transactionId: <transaction_id>
};

// Generate an encrypted request payload
export const data = async (toEncrypt, publicKey) => {
  const buffer = Buffer.from(toEncrypt);
  const encrypted = crypto.publicEncrypt(publicKey, buffer);
  return encrypted.toString('base64');
};

// merchantId – Unique identifier of the Merchant in the Rocketfuel, will get it from the portal. 
// transactionId – Unique identifier of the Transaction initiated by Shopper using RocketFuel, will get it from the Webhook/callback. 
```

<mark style="color:green;">`POST`</mark> `/purchase/invoiceLookup`

#### Headers

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | "Bearer" + merchant access token |

#### Request Body

| Name                                   | Type   | Description               |
| -------------------------------------- | ------ | ------------------------- |
| data<mark style="color:red;">\*</mark> | String | Encrypted request payload |

{% tabs %}
{% tab title="200: OK Success" %}

```javascript
{
    "ok": true,
    "result": [
        {
            "id": <Transaction_id>,
            "status": <Status>,
            "meta": {
                "offerId": <Offer_id>
            },
            "amount": "1.598457239956444619",
            "receivedAmount": "0",
            "currency": "ETH"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

### The webhook payload contains the following fields:

1. **id** – RocketFuel transaction identifier.
2. **status** – 10/0/1 etc. For more information on transaction statuses, [click here](/developer-guides/api-reference/payins/rocketfuel-ui-integration/transaction-statuses.md) to access the full guide.
3. **meta**
   * **offerId** – Unique identifier assigned to the merchant.
4. **amount** – The total price of the complete order.
5. **receivedAmount** – The amount actually received by RocketFuel for the order.
6. **currency** – The unit of currency used by the shopper to make the payment.


---

# 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://docs.rocketfuel.inc/developer-guides/api-reference/payins/rocketfuel-ui-integration/transaction-lookup/lookup-using-public-key.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.
