> For the complete documentation index, see [llms.txt](https://api-docs.fcfpay.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-docs.fcfpay.com/reference/api-requests-v1-deprecated/create-order.md).

# Create Order

## Creating a new order

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

```
curl --location --request POST 'https://merchant.fcfpay.com/api/v1/create-order' \
--header 'Authorization: Bearer YOUR_LIVE_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
	"domain": "yourdomain.com",
	"order_id": "3",
    	"user_id": "1",
	"amount": "10",
	"currency_name": "USD",
	"order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
}'
```

{% endtab %}

{% tab title="JavaScript" %}

```
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer YOUR_LIVE_API_KEY");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "domain": "yourdomain.com",
  "order_id": "3",
  "user_id": "1",
  "amount": "10",
  "currency_name": "USD",
  "order_date": "2022-04-26",
  "redirect_url": "https://yourdomain.com/thank-you/",
  "check_source_url": "https://yourdomain.com/api/v1/check-order"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://merchant.fcfpay.com/api/v1/create-order", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="Node.js" %}

```
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://merchant.fcfpay.com/api/v1/create-order',
  'headers': {
    'Authorization': 'Bearer YOUR_LIVE_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "domain": "yourdomain.com",
    "order_id": "3",
    "user_id": "1",
    "amount": "10",
    "currency_name": "USD",
    "order_date": "2022-04-26",
    "redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

```

{% endtab %}

{% tab title="PHP" %}

```
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://merchant.fcfpay.com/api/v1/create-order',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
	"domain": "yourdomain.com",
	"order_id": "3",
    "user_id": "1",
	"amount": "10",
	"currency_name": "USD",
	"order_date": "2022-04-26",
	"redirect_url": "https://yourdomain.com/thank-you/",
    "check_source_url": "https://yourdomain.com/api/v1/check-order"
}',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer YOUR_LIVE_API_KEY',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

{% endtab %}

{% tab title="Python" %}

```
import requests
import json

url = "https://merchant.fcfpay.com/api/v1/create-order"

payload = json.dumps({
  "domain": "yourdomain.com",
  "order_id": "3",
  "user_id": "1",
  "amount": "10",
  "currency_name": "USD",
  "order_date": "2022-04-26",
  "redirect_url": "https://yourdomain.com/thank-you/",
  "check_source_url": "https://yourdomain.com/api/v1/check-order"
})
headers = {
  'Authorization': 'Bearer YOUR_LIVE_API_KEY',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

| Field              | Description                                                     | Example                                       |
| ------------------ | --------------------------------------------------------------- | --------------------------------------------- |
| domain             | Your domain name                                                | "yourdomain.com"                              |
| order\_id          | The `id` of the order                                           | "3"                                           |
| user\_id           | The user's ID (optional)                                        | "1"                                           |
| amount             | The amount of the order                                         | "10"                                          |
| currency\_name     | The ISO-4217 currency                                           | "USD"                                         |
| order\_date        | The date of the order                                           | "2022-04-26"                                  |
| redirect\_url      | The page where you want to redirect users after the payment     | "<https://yourdomain.com/thank-you/>"         |
| check\_source\_url | Must be return true or false (not required for current version) | "<https://yourdomain.com/api/v1/check-order>" |

## Create an order.

<mark style="color:green;">`POST`</mark> `https://merchant.fcfpay.com/api/v1/create-order`

Creates a new order.

#### Request Body

| Name                                             | Type    | Description                       |
| ------------------------------------------------ | ------- | --------------------------------- |
| domain<mark style="color:red;">\*</mark>         | string  | domain host of the order          |
| order\_id<mark style="color:red;">\*</mark>      | string  | The `id` of the order as a string |
| amount<mark style="color:red;">\*</mark>         | decimal | The amount as a string            |
| currency\_name<mark style="color:red;">\*</mark> | string  | The ISO-4217 currency             |
| redirect\_url<mark style="color:red;">\*</mark>  | string  | The URL where will redirected     |
| order\_date                                      | string  | The date with "YYYY-MM-DD" format |
| check\_source\_url                               | string  | The URL of source                 |
| user\_id                                         | String  | The `id` of the user as a string  |

{% tabs %}
{% tab title="200 Order successfully created" %}

```javascript
{
  "success": true,
  "data": {
    "checkout_page_url": "https://checkout.fcfpay.com/JDJ5JDEwJFB2WjFLZldnbEd0R2JRbWNKOS5Lci5SU1FIVkdSY0ZLQktSZkl2Q0FjclRLdlJXYUZ3VWF5",
    "payment_status": "waiting"
  },
  "message": "Order successfully created. Waiting for the payment."
}
```

{% endtab %}
{% endtabs %}

After order creation, our system will send you a checkout page URL. You should redirect your customers to that URL.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://api-docs.fcfpay.com/reference/api-requests-v1-deprecated/create-order.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
