> For the complete documentation index, see [llms.txt](https://docs.lahza.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lahza.io/payments/verify-payments.md).

# Verify Payments

## Verify Payments

Verify transactions after payments using Lahza's verify API

### How to verify payments <a href="#how-to-verify-payments" id="how-to-verify-payments"></a>

You do this by making a `GET` request to the Verify [TransactionAPI endpoint](https://api-docs.lahza.io/api-endpoints/transactions#verify-transaction) from your server using your transaction reference. This is dependent on the method you used to initialize the transaction.

#### From Popup or Mobile SDKs <a href="#from-popup-or-mobile-sdks" id="from-popup-or-mobile-sdks"></a>

You'll have to send the reference to your server, then from your server you call the verify endpoint.

#### From the Redirect API <a href="#from-the-redirect-api" id="from-the-redirect-api"></a>

You initiate this request from your callback URL. The transaction reference is returned as a query parameter to your callback URL.

{% hint style="info" %}
Always confirm that you have not already delivered value for that transaction to avoid double fulfillments, especially, if you also use webhooks.
{% endhint %}

Here's a code sample for verifying transactions:

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

```url
curl https://api.lahza.io/transaction/verify/:reference
-H "Authorization: Bearer YOUR_SECRET_KEY"
-X GET
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "status": true,
  "message": "Verification successful",
  "data": {
    "id": 690075529,
    "domain": "test",
    "status": "success",
    "reference": "XXXXX",
    "amount": 10000,
    "message": "Approval",
    "gateway_response": "Successful",
    "paid_at": "2023-01-1T12:30:56.000Z",
    "created_at": "2023-01-1T12:26:44.000Z",
    "channel": "card",
    "currency": "ILS",
    "ip_address": "XXXX",
    "metadata": "",
    "log": {
      "start_time": 1589891451,
      "time_spent": 6,
      "attempts": 1,
      "errors": 0,
      "success": true,
      "mobile": false,
      "input": [],
      "history": [
        {
          "type": "action",
          "message": "Attempted to pay with card",
          "time": 5
        },
        {
          "type": "success",
          "message": "Successfully paid with card",
          "time": 6
        }
      ]
    },
    "fees": 100,
    "authorization": {
      "authorization_code": "AUTH_xxxxxxxxxx",
      "bin": "408112",
      "last4": "1000",
      "exp_month": "12",
      "exp_year": "2028",
      "channel": "card",
      "card_type": "visa DEBIT",
      "bank": "Test Bank",
      "country_code": "PS",
      "brand": "visa",
      "reusable": true,
      "signature": "SIG_xxxxxxxxxxxxxxx",
      "account_name": null
    },
    "customer": {
      "id": 24259516,
      "first_name": null,
      "last_name": null,
      "email": "customer@email.com",
      "customer_code": "CUS_xxxxxxxxxxx",
      "phone": null,
      "metadata": null,
      "risk_action": "default"
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
The API response includes a key called `response.status`, which indicates the status of the API call itself. It is important to note that this is not the status of the transaction. To obtain the status of the transaction, you need to refer to the `data` object within the verify API response, specifically `response.data.status`. For more detailed information about the format of the Lahza API responses, please refer to the documentation to gain a comprehensive understanding.
{% endhint %}

### Charge returning Users <a href="#charge-returning-users" id="charge-returning-users"></a>

The verify response also provides information about the payment instrument used by the user in the `data.authorization` object. If the channel indicates a card payment, you can store the `authorization_code` associated with that card for the respective user. This stored authorization code can then be used for future transactions to charge the user conveniently without requiring them to re-enter their payment details. This allows for a seamless payment experience for subsequent transactions. Learn more about [recurring charges](/payments/recurring-charges.md).
