Register your application to receive postback updates

Would you like to get updates about each order? Create a URL that will receive POST events, and use this function to register it. If you choose not to implement this, then you can still request the current status on any (or all) order.

POST: https://coberapi.com/api/1.0/register
postbackurl
"postbackurl": "https://yoursite.com/api/postback.php"
A URL to a location on YOUR website that is ready to receive POST messages from us.

Sample Code

Sample server file

Here is a very simple file that I can use to receive feedback from orders. I saved it as api/postback.php

        
    header("Access-Control-Allow-Origin: *");
    $noDB = true;
    $json = file_get_contents('php://input');
    $message = json_decode($json);

    switch($message->message) {
        case 'Order Received':
            file_put_contents('demooutput.txt', "Cober has received order #" . $message->OrderID . PHP_EOL, FILE_APPEND|LOCK_EX);
            break;
        default:
            file_put_contents('demooutput.txt', 'An unexpected message has arrived from Cober ' . $json . PHP_EOL, FILE_APPEND|LOCK_EX);
            break;
    }