How to add order via API?
Post: http://www.namedoseusite.com.br/api_ds_orders.php?action=add_orders
Header Parameter | format |
token | base64_encode () |
Secret | base64_encode () |
base64_encode () |
Parameter | format | description | |
Products_id | json | use the api to list the order data to get the product_id format: int (11) |
|
Products_quantity | json | Quantity Number Only Number is Required |
|
Products | json | Products_id & amp; Products_quantity | |
Delivery_FirstName | json | FirstName Format: Varchar (255) * Field Required |
|
delivery_lastname | json | LastName Format: Varchar (255) * Field Required |
|
delivery_street_address | json | Street Address Format: Varchar (255) * Field Required |
|
delivery_number | json | Delivery Number Format: Varchar (255) * Field Required |
|
delivery_suburb | json | Suburb Format: varchar (255) * Field Required |
|
Delivery_City | json |
|
|
Delivery_PostCode | json | Post Code Format: Varchar (11) * Field Required |
|
delivery_country | json | country name format: varchar (255) * Field Required |
|
delivery_state | json | State Name Format: Varchar (2) * Field Required |
|
Payment_Method | json | Use the Api to Payment_Method Format: Varchar (255) * Field Required |
|
shipping_method | json | use the api to calculate_shipping format: varchar (255) * Field Required |
php sample
// sample add_orders
$ URL = $ tabain_url. ' /api_ds_orders.php? Action = add_orders ' ;;
$ Data_Products [0] = array ("Products_id" = & gt; "215", // Example: 130 (Only Number Is Required) * Field Required
"Products_quantity" = & gt; "1" // Example: 1 (Only Number Is Required) * Field Required
);$ Data_Products [1] = array ("Products_id" = & gt; "215", // Example: 130 (Only Number Is Required) * Field Required
"Products_quantity" = & gt; "1" // Example: 1 (Only Number Is Required) * Field Required
);$ Data = array ("Products" = & gt; $ data_products, // * Field Required
"Delivery_FirstName" = & gt; utf8_encode ("name"), // Example: Name (FirstName) * Field Required
"delivery_lastname" = & gt; utf8_encode ("surname"), // Example: Surname (LastName) * Field Required
"delivery_street_address" = & gt; UTF8_EnCode ("Street Address"), // Example: Street Address (Street Address) * Field Required
"delivery_number" = & gt; "123", // Example: 123 (Delivery Number) * Field Required
"delivery_suburb" = & gt; UTF8_Encode ("Suburb"), // Example: Suburb (Suburb) * Field Required
"delivery_city" = & gt; utf8_encode ("Sao Paulo"), // Example: Sao Paulo (City) * Field Required
"DELIVERY_POSTCODE" = & gt; "04267000", // Example: 04267000 (post code) * Field Required
"delivery_country" = & gt; utf8_encode ("Brazil"), // Example: Brazil (country) * Field Required
"delivery_state" = & gt; utf8_encode ("sp"), // Example: SP (state) * Field Required
"Payment_Method" = & gt; "Paypal_standard", // Example: PayPal_Standard (Payment Method) * Field Required
"shipping_method" = & gt; "SEDEX" // Example: Sedex (Shipping Method) * Field Required
);$ data_string = json_encode ($ date);
// print_r ($ data_string);
// Die;$ CH = curl_init ($ URL);
Curl_Setopt ($ CH, curlopt_customrequest, "post");
Curl_Setopt ($ CH, Curlopt_postFields, $ Data_String);
Curl_Setopt ($ CH, Curlopt_Returntransfer, True);
curl_setopt ($ CH, curlopt_ssl_verifypeer, false);
Curl_Setopt ($ CH, Curlopt_httpheader, Array (
' CONTENT-TYPE: Application/JSON ',
"Cache-Control: No-Cache",
' TOKEN: ' . base64_encode ($ token),
' Secret: ' . base64_encode ($ secret),
' E-mail: ' . base64_encode ($ email),
' CONTENT-LENGTH: ' . Strlen ($ data_string)))
);$ result = curl_exec ($ CH);
Curl_Close ($ CH);print_r ($ result);
// sample add_orders eofReturn Error:
Code
MessageReturn Success:
code
Products_Model
Products_id
Message