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

# Create Payment

To obtain a payment link, you must first create a payment request. By sending the specified link and request contents below, you need to direct the user to the specified payment link. The result will

## 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 %}
