# Creating orders using php

**URL:** <https://developer-forum.veeqo.com/t/creating-orders-using-php/1007>\
**Category:** API Queries (How To)\
**Created:** [May 3, 2024, 9:18am UTC](https://developer-forum.veeqo.com/t/creating-orders-using-php/1007 "2024-05-03T09:18:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben-Veeqo](https://avatars.discourse-cdn.com/v4/letter/b/232F3E/32.png) [@Ben-Veeqo](https://developer-forum.veeqo.com/u/Ben-Veeqo)\
**Post date:** [May 3, 2024, 9:18am UTC](https://developer-forum.veeqo.com/t/creating-orders-using-php/1007/1 "2024-05-03T09:18:28Z")

</div>

I am trying to create the orders using php for all our reverb orders , but seems like i am missing something here can you please assist on this ? Thanks!

// Data sent in the request  
$data = array(  
‘order’ =\> array(  
‘channel\_id’ =\> 224589,  
‘customer\_id’ =\> 0,  
‘deliver\_to\_id’ =\> 0,  
‘delivery\_method\_id’ =\> 0,  
‘due\_date’ =\> ‘05-05-2024’,  
‘number’ =\> ‘143214351456’,  
‘send\_notification\_email’ =\> false,  
‘total\_discounts’ =\> 0,  
‘deliver\_to\_attributes’ =\> array(  
‘address1’ =\> ‘Address line 1 Address line 1’,  
‘address2’ =\> ‘Address line 2 Address line 2 Address line 2’,  
‘city’ =\> ‘SNELLVILLE’,  
‘company’ =\> ‘company string Pvt Ltd’,  
‘country’ =\> ‘United States’,  
‘customer\_id’ =\> 0,  
‘first\_name’ =\> ‘CUST\_FNAME’,  
‘last\_name’ =\> ‘LNAME’,  
‘phone’ =\> ‘+1 415-851-9136’,  
‘state’ =\> ‘GA’,  
‘zip’ =\> ‘30078-7388’  
),  
‘line\_items\_attributes’ =\> array(  
array(  
‘sellable\_id’ =\> 204226950,  
‘price\_per\_unit’ =\> 200,  
‘quantity’ =\> 1,  
‘tax\_rate’ =\> 0,  
‘taxless\_discount\_per\_unit’ =\> 0,  
‘additional\_options’ =\> ‘string’  
)  
),  
‘payment\_attributes’ =\> array(  
‘payment\_type’ =\> ‘Other’,  
‘reference\_number’ =\> ‘string’  
),  
‘customer\_note\_attributes’ =\> array(  
‘text’ =\> ‘string’  
),  
‘employee\_note\_attributes’ =\> array(  
array(  
‘text’ =\> ‘string’  
)  
)  
)  
);

// Convert data to JSON format  
$post\_data = json\_encode($data);

// Initialize cURL session  
$curl = curl\_init();

// Set cURL options  
curl\_setopt\_array($curl, array(  
CURLOPT\_URL =\> $api\_url,  
CURLOPT\_RETURNTRANSFER =\> true,  
CURLOPT\_CUSTOMREQUEST =\> ‘POST’,  
CURLOPT\_POSTFIELDS =\> $post\_data,  
CURLOPT\_HTTPHEADER =\> array(  
‘accept: application/json’,  
'x-api-key: ’ . $api\_key,  
‘Content-Type: application/json’  
)  
));

// Execute cURL request and store the response  
$response = curl\_exec($curl);

// Check for cURL errors  
if (curl\_errno($curl)) {  
echo 'Error: ’ . curl\_error($curl);  
} else {  
// Print the API response  
echo $response;  
}

// Close cURL session  
curl\_close($curl);

---

<div class="post-metadata">

**Author:** ![leialeja](https://avatars.discourse-cdn.com/v4/letter/l/9B8BFF/32.png) [@leialeja](https://developer-forum.veeqo.com/u/leialeja)\
**Post date:** [May 7, 2024, 7:22pm UTC](https://developer-forum.veeqo.com/t/creating-orders-using-php/1007/2 "2024-05-07T19:22:46Z")

</div>

Hello @Ben-Veeqo

Could you please share with me the URL you are using?

As it include something like this: [http://api.veeqo.com/orders](http://api.veeqo.com/orders)

Also could you provide the response you are getting?

Thanks.

For more information please follow: [API Docs - Veeqo Developers](https://developer.veeqo.com/docs#/reference/orders)
