# Create Payment

## Overview

The `/quickbuy/v1/create` endpoint is designed for merchants using QuickBuy Pro to initiate the payment process. When a payment order is created, it is accessible via the `PaymentURL` provided in the API response. This URL serves as a direct link for clients to process their payments.

Payments have a limited active period, which can be customized per order using the `timeoutMin` parameter. If this parameter is not specified, the payment will default to the merchant's predetermined timeout settings.

* **Endpoint**: `/quickbuy/v1/create`
* **Method:** `POST`
* **Content-Type**: `application/json`

#### Request Body Parameters

* **`client`** (Object): Contains client related data
  * **`reference`** (String, min 15 chars, max 75 chars, Optional): Customer reference field for a merchant to set. This enables a merchant to quickly associate a **CustomerReference** with their own database
  * **`first`** (String, min 2 chars, max 100 chars, Optional): Client first name
  * **`last`** (String, min 2 chars, max 100 chars, Optional): Client last name
  * **`email`** (String, Optional): Client email
  * **`phone`** (String, Optional): Client phone number
* **`payment`** (Object): Contains payment configuration
  * **`amount`** (Number, Required): The amount of the payment
  * **`currency`** (String, ISO 4217, Required): The currency for the payment. **(ONLY USD AVAILABLE)**
  * **`timeoutMin`** (Number, min 1, max 10080, optional): The number of minutes that a payment is active for. Minimum of 1 minute, maximum of 10,080 minutes (1 week). If no value is provided, this timeout value will default to the merchant default value.
* **`redirectURL`** (string, optional): URL of the webpage to be redirected to, 5 seconds after a card is processed. The URL must use HTTPS.

#### **Request Body Example**

```json
{
    "client": {
        "reference": "john-doe-1234-user" 
    },
    "payment": {
        "amount": 102.96,
        "currency": "USD",
        "timeoutMin": 1440 // 1 day
    },
    "redirectURL": "https://ibanera.com/"
}
```

#### Response

```json5
{
    "success": true,
    "details": {
        "id": "66251f21c12e178b83c2a3be",
        "UserReference": "john-doe-1234-user",
        "Amount": 102.96,
        "Currency": "USD",
        "PaymentURL": "https://quickpay.ibanera.com/v1/66251f21c12e178b83c2a3be",
        "ExpireDateUTC": "2024-04-22T14:13:53.739Z",
        "ExpireMinutesFromNow": 1440
    }
}
```

Once you've received a successful response, indicated by <mark style="color:blue;">`"success": true`</mark> you can host the **PaymentURL**.

#### Response Error Example (400 Bad Request)

```json
{
    "error": "payment.amount is a required field"
}
```


---

# 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://customer-api-docs.ibanera.com/quickbuy/quickbuy-pro/api-endpoints/create-payment.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.
