> For the complete documentation index, see [llms.txt](https://docs.rocketfuel.inc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.rocketfuel.inc/developer-guides/api-reference/payins/rocketfuel-ui-integration/transaction-lookup/lookup-using-public-key.md).

# 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.
