Project

General

Profile

API - Account - Order history

Orders list

URL: /account/order-history/
Method: GET

$api_id = 1;
$api_key = 'testpass';
$hostname = 'https://example.com'; // no trailing slash

# fetch data
$url = '/account/order-history/';
$post_data = array();
$user_token = 'xxx'; // is required here. Get it from Your DB after Token generation
$extra_headers = array(
    'X-API-ID: ' . $api_id,
    'X-API-Hash: ' . md5($api_key . $url. http_build_query($post_data)),
    'X-User-Token: ' . $user_token
);

header('Content-Type: application/json; charset=utf-8');
echo sendRequest($hostname . $url, $post_data, $extra_headers);

Succes message:

{
    has_error: false,
    messages: {
        section: "order-history" 
    },
    results: {
        orders: []
    }
}

Error message:

{
    has_error: true,
    messages: [
        "Not logged in" 
    ],
    results: [ ]
}

Order details

URL: /account/order-history/1234/
Method: GET

// ...
$url = '/account/order-history/1234/';
// ...

Succes message:

{
    has_error: false,
    messages: {
        section: "order-history-details" 
    },
    results: {
        order_history: [ ],
        order_products: [],
        sections: [ ],
        orderinfo: {}
    }
}

Error message:

{
    has_error: true,
    messages: [
        "Invalid order ID" 
    ],
    results: [ ]
}

Send a message for an order

URL: /account/order-history/1234/
Method: POST

// ...
$url = '/account/order-history/1234/';
$post_data = array(
    'message' => 'Test message'
);
// ...

Succes message:

{
    has_error: false,
    messages: [ ],
    results: {
        request_status: "ok",
        request_message: "Mesajul dumneavoastra a fost trimis. Un consultant de vanzari XXX va raspunde cat mai curand posibil. In momentul in care primiti un raspuns, veti fi anuntat automat prin e-mail." 
    }
}

Cancel a pending order

URL: /account/order-history/1234/
Method: POST

// ...
$url = '/account/order-history/1234/';
$post_data = array(
    'cancel_order' => 1,
    'cancel_reason' => 'Test reason'
);
// ...

Succes message:

{
    has_error: false,
    messages: [ ],
    results: {
        request_status: "ok",
        request_message: "Comanda dvs. a fost anulata. Va multumim." 
    }
}

Error message:

{
    has_error: true,
    messages: {
        reason_missing: "Completati motivul anularii comenzii." 
    },
    results: [ ]
}

Go to top