Help Center

API

Chris Muench
Chris Muench

NEW Feature

API is a new feature for version 16. 1

To create an API key to use PHP POS's API you navigate to store config --> scroll to bottom --> Add API Key. Once you click add API key we generate a key for you that you can save.

Screenshot_2018-04-16_14.53.54.pngScreenshot_2018-04-16_14.54.00.png

You can then use this API information to create requests by following our API document @

https://phppointofsale.com/api.php

 

Was this article helpful?

2 out of 3 found this helpful

Have more questions? Submit a request

Comments

8 comments

  • Comment author
    Mohammed Ali

    Any plans of introducing web hook for price inventory sync soon?

    0
  • Comment author
    Mohammedjawaad Kassam

    I managed to run but getting empty response

    0
  • Comment author
    Mohammedjawaad Kassam

    <?php

    $request = new HttpRequest();
    $request->setUrl('https://dukadirect.phppointofsale.com/index.php/api/v1/customers');
    $request->setMethod(HTTP_METH_POST);

    $request->setHeaders(array(
    'postman-token' => '0d010222-94c3-2cb8-c56d-c3c0210703bf',
    'cache-control' => 'no-cache',
    'content-type' => 'application/json',
    'x-api-key' => 'wssc08gkcg40koc8ck8g0o4scg0gwk8w0808k84c'
    ));

    $request->setBody('{
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com",
    "phone_number": "555-555-5555",
    "address_1": "123 Nowhere Street",
    "address_2": "Apartment 123",
    "city": "Rochester",
    "state": "New York",
    "zip": "14445",
    "country": "United States",
    "comments": "A great customer",
    "custom_fields": {
    "secondary phone number": "555-555-5555"
    },
    "company_name": "PHP Point Of Sale",
    "tier_id": 0,
    "account_number": "3333",
    "taxable": false,
    "tax_certificate": "1234",
    "internal_notes": "A nice guy",
    "override_default_tax": false,
    "tax_class_id": 0,
    "balance": 22.99,
    "credit_limit": 1000,
    "points": 333,
    "disable_loyalty": true,
    "location_id": 1,
    "image_url": "http://www.abc.xyz"
    }');

    try {
    $response = $request->send();

    echo $response->getBody();
    } catch (HttpException $ex) {
    echo $ex;
    }

    0
  • Comment author
    Chris Muench

    As of now there aren’t plans

    We have a feedback site where you provide feature requests and see other requests. You can also upvote existing feature requests and get alerts on requests you interact with.

    This provides php point of sale with a clear roadmap of what customers want so we develop the right features

    The site is:

    https://feedback.phppointofsale.com

    0
  • Comment author
    Chris Muench

    only first_name is required

    0
  • Comment author
    Chris Muench

    Please share requests/responses and/or code. Here is example code to get items

     

    <?php

    //////////////////////////////////////////////////////////

    $api_base_url = 'http://localhost/phppos/PHP-Point-Of-Sale/index.php/api/v1/';

    $api_key = 'k4koggkc0k40k8w0kkc00gckkcs8kw888sskks0o';

    ///////////////////////////////////////////////////////////







    $curl = curl_init();

    curl_setopt($curl, CURLOPT_URL, $api_base_url.'items');

    curl_setopt($curl, CURLOPT_HTTPHEADER, array(

        'x-api-key:'.$api_key,

    'accept: application/json',

        ));

    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);

    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 




    $result = json_decode(curl_exec($curl), TRUE);

    echo '<pre>';

    var_dump($result);

    echo '</pre>';

     

    0
  • Comment author
    Chris Muench

    In your code makes sure you remove fields you aren't using. For example, tier_id should NOT be in the request

    0
  • Comment author
    Mohammedjawaad Kassam

    how do i know which fields are not required?

    0

Please sign in to leave a comment.