# Create Payment

## Create a new payment

{% hint style="danger" %}
Please do not process transactions during user return for payments. Use the webhook for this purpose.
{% endhint %}

<mark style="color:green;">`POST`</mark> `/payment/create`

If the customer is not registered, a new customer will be automatically created. The same applies to the product. The Success URL and Failed URL specify the page link to which the user will be redirected.

**Body**

| Name               | Type    | Description                       |
| ------------------ | ------- | --------------------------------- |
| `api_key`          | string  | API Key                           |
| `payment_id`       | string  | The payment number created by you |
| `product_name`     | number  | Product name                      |
| `product_price`    | decimal | Product price                     |
| `customer_name`    | string  | Customer name                     |
| `customer_email`   | string  | Customer email                    |
| `customer_phone`   | string  | Customer phone                    |
| `customer_address` | string  | Customer address                  |
| `amount`           | decimal | Amount                            |
| `success_url`      | string  | Success url                       |
| `failed_url`       | string  | Failed url                        |

**Response**

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

```json
{
  "status": "success",
  "payment_link": "https://example.com/p/11122",
  "payment_id": "123"
  "amount": 10.2
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request",
  "message": "customer_phone required"
}
```

{% 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://payduox.gitbook.io/untitled/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.
