# Payment Pages

## Create Page

<mark style="color:green;">`POST`</mark> `https://api.lahza.io/page`

Create a payment page on your integration

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| authorization<mark style="color:red;">\*</mark> | String | <p>Set value to Bearer SECRET\_KEY<br></p> |
| content-type<mark style="color:red;">\*</mark>  | String | Set value to application/json              |

#### Request Body

| Name                                   | Type   | Description                                                                                                          |
| -------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark> | String | <p>Name of page<br></p>                                                                                              |
| redirect\_url                          | String | If you would like Lahza to redirect someplace upon successful payment, specify the URL here.                         |
| metadata                               | object | Extra data to configure the payment page including, logo image                                                       |
| slug                                   | String | URL slug you would like to be associated with this page. Page will be accessible at <https://pay.lahza.iom/\\[slug>] |
| amount                                 | String | Amount should be in agora if currency is ILS, qirsh, if currency is JOD, and cents, if currency is USD               |
| description                            | String | A description for this page                                                                                          |
| custom\_fields                         | array  | If you would like to accept custom fields, specify them here.                                                        |

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

```json
{
  "status": true,
  "message": "Page created",
  "data": {
    "name": "Testing page",
    "description": "This is the description",
    "domain": "live",
    "slug": "jwirRT64W",
    "currency": "ILS",
    "active": true,
    "id": 18,
    "createdAt": "2023-02-30T01:49:57.514Z",
    "updatedAt": "2023-02-30T01:49:57.514Z"
  }
}
```

{% endtab %}
{% endtabs %}

## List Pages

<mark style="color:blue;">`GET`</mark> `https://api.lahza.io/page`

List payment pages available on your integration.

#### Query Parameters

| Name    | Type     | Description                                                                                                     |
| ------- | -------- | --------------------------------------------------------------------------------------------------------------- |
| perPage | integer  | <p>Specify how many records you want to retrieve per page. If not specify we use a default value of 50.<br></p> |
| page    | integer  | <p><br>Specify exactly what page you want to retrieve. If not specify we use a default value of 1.</p>          |
| to      | datetime | A timestamp at which to stop listing page e.g. 2023-09-24T00:00:05.000Z, 2023-09-21                             |
| from    | datetime | A timestamp from which to start listing page e.g. 2023-09-24T00:00:05.000Z, 2023-09-21                          |

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| authorization<mark style="color:red;">\*</mark> | String | Set value to Bearer SECRET\_KEY |

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

```json
{
  "status": true,
  "message": "Pages retrieved",
  "data": [
    {
      "domain": "test",
      "name": "Donation Page",
      "description": null,
      "amount": null,
      "currency": "NGN",
      "slug": "kdjrWH46J",
      "custom_fields": null,
      "redirect_url": null,
      "active": true,
      "id": 2223,
      "createdAt": "2016-10-01T10:59:11.000Z",
      "updatedAt": "2016-10-01T10:59:11.000Z"
    },
    {
      "domain": "test",
      "name": "Name of the page",
      "description": "description",
      "amount": 10000,
      "currency": "ILS",
      "slug": "special-slug",
      "custom_fields": [
        {
          "display_name": "Speciality",
          "variable_name": "speciality"
        },
        {
          "display_name": "Age",
          "variable_name": "age"
        }
      ],
      "redirect_url": "http://example.com",
      "active": true,
      "id": 1807,
      "createdAt": "2023-11-09T19:18:37.000Z",
      "updatedAt": "2023-11-14T17:51:49.000Z"
    }
  ],
  "meta": {
    "total": 2,
    "skipped": 0,
    "perPage": "3",
    "page": 1,
    "pageCount": 1
  }
}
```

{% endtab %}
{% endtabs %}

## Fetch Page

<mark style="color:blue;">`GET`</mark> `https://api.lahza.io/page/:id_or_slug`

Get details of a payment page on your integration.

#### Path Parameters

| Name                                           | Type   | Description                                      |
| ---------------------------------------------- | ------ | ------------------------------------------------ |
| id\_or\_slug<mark style="color:red;">\*</mark> | String | <p>The page ID or slug you want to fetch<br></p> |

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| authorization<mark style="color:red;">\*</mark> | String | Set value to Bearer SECRET\_KEY |

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

```json
{
  "status": true,
  "message": "Page retrieved",
  "data": {
    "domain": "test",
    "name": "Test page",
    "description": "description of the page.",
    "amount": 10000,
    "currency": "ILS",
    "slug": "ji84Ju234J",
    "active": true,
    "id": 112,
    "createdAt": "2023-10-30T00:49:57.000Z",
    "updatedAt": "2023-10-30T00:49:57.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

## Update Page

<mark style="color:orange;">`PUT`</mark> `https://api.lahza.io/page/:id_or_slug`

Update a payment page details on your integration

#### Headers

| Name                                            | Type   | Description                                |
| ----------------------------------------------- | ------ | ------------------------------------------ |
| authorization<mark style="color:red;">\*</mark> | String | <p>Set value to Bearer SECRET\_KEY<br></p> |
| id\_or\_slug                                    | String | Page ID or slug                            |
| content-type<mark style="color:red;">\*</mark>  | String | Set value to application/json              |

#### Request Body

| Name                                   | Type    | Description                                                                                             |
| -------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark> | String  | Name of page                                                                                            |
| amount                                 | integer | Amount should be in aghora if currency is ILS, qirsh, if currency is JOD, and cents, if currency is USD |
| description                            | String  | A description for this page                                                                             |
| active                                 | boolean | Set to false to deactivate page url                                                                     |

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

```json
{
  "status": true,
  "message": "Page updated",
  "data": {
    "domain": "test",
    "name": "Buttercup Brunch",
    "description": "Gather your friends for the ritual that is brunch",
    "amount": null,
    "currency": "NGN",
    "slug": "5nApBwZkvY",
    "active": true,
    "id": 18,
    "integration": 100032,
    "createdAt": "2016-03-30T00:49:57.000Z",
    "updatedAt": "2016-03-30T04:44:35.000Z"
  }
}
```

{% endtab %}
{% endtabs %}

## Check Slug Availability

<mark style="color:blue;">`GET`</mark> `https://api.lahza.io/page/check_slug_availability/:slug`

Check the availability of a slug for a payment page.

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| slug | String | URL slug to be confirmed |

#### Headers

| Name                                            | Type   | Description                     |
| ----------------------------------------------- | ------ | ------------------------------- |
| authorization<mark style="color:red;">\*</mark> | String | Set value to Bearer SECRET\_KEY |

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

```json
{
  "status": true,
  "message": "Page retrieved",
  "data": {
    "integration": 100032,
    "domain": "test",
    "name": "Offering collections",
    "description": "Give unto the Lord, and it shall be multiplied ten-fold to you.",
    "amount": null,
    "currency": "NGN",
    "slug": "5nApBwZkvY",
    "active": true,
    "id": 18,
    "createdAt": "2016-03-30T00:49:57.000Z",
    "updatedAt": "2016-03-30T00:49:57.000Z",
    "products": [
      {
        "product_id": 523,
        "name": "Product Four",
        "description": "Product Four Description",
        "product_code": "PROD_l9p81u9pkjqjunb",
        "page": 18,
        "price": 500000,
        "currency": "NGN",
        "quantity": 0,
        "type": "good",
        "features": null,
        "is_shippable": 0,
        "domain": "test",
        "integration": 343288,
        "active": 1,
        "in_stock": 1
      },
      {
        "product_id": 522,
        "name": "Product Five",
        "description": "Product Five Description",
        "product_code": "PROD_8ne9cxutagmtsyz",
        "page": 18,
        "price": 500000,
        "currency": "NGN",
        "quantity": 0,
        "type": "good",
        "features": null,
        "is_shippable": 0,
        "domain": "test",
        "integration": 343288,
        "active": 1,
        "in_stock": 0
      }
    ]
  }
}
```

{% 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://api-docs.lahza.io/api-endpoints/payment-pages.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.
