Checkfront/PHP-SDK - outdated examples

I worked out after 30mins of trying to get the example to work that they are outdated. Please could I get updated examples for the PHP-SDK.
Many thanks.

Comments

  • MitchMitch Checkfront Team
    Hi STiTCHi,

    Thanks for reaching out on the forums!

    Which example is outdated? What issue have you experienced when trying to replicate the example?

    Mitch
    Checkfront support team
  • edited June 2016
    Thanks for the quick reply. So the 'consumer_key' and 'api_key' in the array are named differently is this to do with the different auth types?.. The SDK uses 'consumer_key'. So without looking into too much further. I was wondering if you have an updated example many thanks. *Can't get the example working. example:
    $this->Checkfront = new Checkfront(
        array(
            'host' => 'your-company.checkfront.com',
            'auth_type' => 'token',
            'api_key' => '',
            'api_secret' => '',
            'account_id' => 'off',
    	)
    );
    
    vs the on GitHub page; https://github.com/Checkfront/PHP-SDK at the bottom how to use:
    $Checkfront = new Checkfront(
        array(
            'host'=>'your-company.checkfront.com',
            'consumer_key'  => '5010076404ec1809470508',
            'consumer_secret' => 'ba0a5c0c509445024c374fcd264d41e816b02d4e',
            'redirect_uri'=>'oob',
        )
    );
    
  • The SDK samples haven't been updated for some time, so they are fairly basic, but they are still applicable and can be made to function relatively easily; in your own comment you have both the static token and oauth2 keys present and prepared to be filled -- you'd need only follow along the accompanying documentation to your desired auth method, or make a few quick adjustments to the code to get it running.  

    You can find a guide on setting up the SDK authentication here: http://api.checkfront.com/guide/sdk_setup.html
  • @Kris many thanks for that I have made an item call but the slip in the response is empty. If you could point out where i've missed the mark that would be most appreciated.

    my call using the php-SDK:
    $items = $Booking->query_inventory(
    array(
    'start_date'=>$date,
    'end_date'=>$date,
    'start_time'=>'10:00',
    'end_time'=>'11:00',
    // change these booking parameters to suit your setup:
    'param'=>array( 'adult' => 4, 'child' => 2)
    )
    );
    

    my response:
    Array
    (
    [7] => Array
    (
    [unit] => H
    [item_id] => 7
    [sku] => general-air
    [url] => 0
    [lock] => 1
    [visibility] => *
    [name] => General Air
    [pos] => 0
    [summary] =>
    [details] =>
    [meta] => Array
    (
    [display_mode] => dropdown
    [item_package_rate] =>
    [delay] => 0
    )
    
    [stock] => 100
    [unlimited] => 0
    [video] => Array
    (
    [id] =>
    [start] => 0
    )
    
    [image] => Array
    (
    )
    
    [category_id] => 1
    [rated] => 1
    [type] => I
    [status] => A
    [alias_id] => 0
    [len] => 0
    [rules] => {"param":{"adult":{"MIN":"0","MAX":"100"},"child":{"MIN":"0","MAX":"100"},"student":{"MIN":"0","MAX":"100"},"socks":{"MIN":"0","MAX":"0"}},"fixed":{"start_time":""}}
    [category] => General Admission
    [param] => Array
    (
    [adult] => Array
    (
    [price] => 1
    [lbl] => Adult
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [def] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [child] => Array
    (
    [price] => 1
    [lbl] => Child
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [student] => Array
    (
    [price] => 1
    [lbl] => Student
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [socks] => Array
    (
    [price] => 1
    [lbl] => Socks
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 0
    [def] => 1
    [MIN] => 0
    [MAX] => 0
    )
    
    )
    
    [qty] => 1
    [rate] => Array
    (
    [status] => AVAILABLE
    [available] => 100
    [slip] =>
    [summary] => Array
    (
    [title] => Available
    [details] => Adult: 1 Hour @ $15.00
    Socks: 1 x 1 Hour @ $2.00
    [price] => Array
    (
    [total] => $17.00
    [title] => $2.00 - $15.00
    [unit] => per hour
    [param] => Array
    (
    [adult] => $15.00
    [child] => $10.00
    [student] => $11.50
    [socks] => $2.00
    )
    
    )
    
    [date] => Wed Jul 27, 2016
    )
    
    [sub_total] => 17.00
    [event] => Array
    (
    [0] => Array
    (
    [adult] => Array
    (
    [amount] => 15.00
    [days] => 1
    [hours] => 0
    )
    
    [child] => Array
    (
    [amount] => 10.00
    [days] => 1
    [hours] => 0
    )
    
    [student] => Array
    (
    [amount] => 11.50
    [days] => 1
    [hours] => 0
    )
    
    [socks] => Array
    (
    [amount] => 2.00
    [days] => 1
    [hours] => 0
    )
    
    )
    
    )
    
    [start_time] => 09:00 AM
    [end_time] => 10:00 AM
    [start_date] => 20160727
    [end_date] => 20160727
    [dates] => Array
    (
    [20160727] => Array
    (
    [status] => A
    [price] => Array
    (
    [adult] => 15.00
    [child] => 10.00
    [student] => 11.50
    [socks] => 2.00
    )
    
    [dow] => 3
    [stock] => Array
    (
    [T] => 100
    [B] => 0
    [A] => 100
    )
    
    [times] => Array
    (
    [09:00] => Array
    (
    [A] => 100
    )
    
    [10:00] => Array
    (
    [A] => 100
    )
    
    [11:00] => Array
    (
    [A] => 100
    )
    
    [12:00] => Array
    (
    [A] => 100
    )
    
    [13:00] => Array
    (
    [A] => 100
    )
    
    [14:00] => Array
    (
    [A] => 100
    )
    
    [15:00] => Array
    (
    [A] => 100
    )
    
    [16:00] => Array
    (
    [A] => 100
    )
    
    [17:00] => Array
    (
    [A] => 100
    )
    
    [18:00] => Array
    (
    [A] => 100
    )
    
    [19:00] => Array
    (
    [A] => 100
    )
    
    )
    
    [hours] => Array
    (
    [adult] => 1
    [child] => 1
    [student] => 1
    [socks] => 1
    )
    
    [sub_total] => 17
    )
    
    )
    
    )
    
    [hours] => 1
    [days] => 1
    [gprice] => Array
    (
    )
    
    [local_start_date] => 27/07/2016
    [local_end_date] => 27/07/2016
    [start_time] => 09:00
    [end_time] => 10:00
    )
    
    [3] => Array
    (
    [unit] => H
    [item_id] => 3
    [sku] => 1-hr-sesh
    [url] => 0
    [lock] => 1
    [visibility] => *
    [name] => One hour session
    [pos] => 0
    [summary] =>
    [details] =>
    [meta] => Array
    (
    [default_len] => 1
    [display_mode] => dropdown
    [item_package_rate] =>
    [delay] => 0
    )
    
    [stock] => 100
    [unlimited] => 0
    [video] => Array
    (
    [id] =>
    [start] => 0
    )
    
    [image] => Array
    (
    )
    
    [category_id] => 1
    [rated] => 1
    [type] => I
    [status] => A
    [alias_id] => 0
    [len] => 1
    [rules] => {"param":{"adult":{"MIN":"0","MAX":"100"},"child":{"MIN":"0","MAX":"100"},"student":{"MIN":"0","MAX":"100"},"socks":{"MIN":"0","MAX":"0"}},"fixed":{"start_time":""}}
    [category] => General Admission
    [param] => Array
    (
    [adult] => Array
    (
    [price] => 1
    [lbl] => Adult
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [def] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [child] => Array
    (
    [price] => 1
    [lbl] => Child
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [student] => Array
    (
    [price] => 1
    [lbl] => Student
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [socks] => Array
    (
    [price] => 1
    [lbl] => Socks
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 0
    [def] => 1
    [MIN] => 0
    [MAX] => 0
    )
    
    )
    
    [qty] => 1
    [rate] => Array
    (
    [status] => AVAILABLE
    [available] => 100
    [slip] =>
    [summary] => Array
    (
    [title] => Available
    [details] => Adult: 1 @ $15.00
    Socks: 1 @ $2.00
    [price] => Array
    (
    [total] => $17.00
    [title] => $2.00 - $15.00
    [unit] =>
    [param] => Array
    (
    [adult] => $15.00
    [child] => $10.00
    [student] => $11.50
    [socks] => $2.00
    )
    
    )
    
    [date] => Wed Jul 27, 2016
    )
    
    [sub_total] => 17.00
    [event] => Array
    (
    [0] => Array
    (
    [adult] => Array
    (
    [amount] => 15.00
    [days] => 1
    [hours] => 0
    )
    
    [child] => Array
    (
    [amount] => 10.00
    [days] => 1
    [hours] => 0
    )
    
    [student] => Array
    (
    [amount] => 11.50
    [days] => 1
    [hours] => 0
    )
    
    [socks] => Array
    (
    [amount] => 2.00
    [days] => 1
    [hours] => 0
    )
    
    )
    
    )
    
    [start_time] => 09:00 AM
    [end_time] => 10:00 AM
    [start_date] => 20160727
    [end_date] => 20160727
    [dates] => Array
    (
    [20160727] => Array
    (
    [status] => A
    [price] => Array
    (
    [adult] => 15.00
    [child] => 10.00
    [student] => 11.50
    [socks] => 2.00
    )
    
    [dow] => 3
    [stock] => Array
    (
    [T] => 100
    [B] => 0
    [A] => 100
    )
    
    [times] => Array
    (
    [09:00] => Array
    (
    [A] => 100
    )
    
    [10:00] => Array
    (
    [A] => 100
    )
    
    [11:00] => Array
    (
    [A] => 100
    )
    
    [12:00] => Array
    (
    [A] => 100
    )
    
    [13:00] => Array
    (
    [A] => 100
    )
    
    [14:00] => Array
    (
    [A] => 100
    )
    
    [15:00] => Array
    (
    [A] => 100
    )
    
    [16:00] => Array
    (
    [A] => 100
    )
    
    [17:00] => Array
    (
    [A] => 100
    )
    
    [18:00] => Array
    (
    [A] => 100
    )
    
    [19:00] => Array
    (
    [A] => 100
    )
    
    )
    
    [hours] => Array
    (
    [adult] => 1
    [child] => 1
    [student] => 1
    [socks] => 1
    )
    
    )
    
    )
    
    )
    
    [hours] => 1
    [fixed] => Array
    (
    [end_time] => 1
    )
    
    [days] => 1
    [gprice] => Array
    (
    )
    
    [local_start_date] => 27/07/2016
    [local_end_date] => 27/07/2016
    [start_time] => 09:00
    [end_time] => 10:00
    )
    
    [4] => Array
    (
    [unit] => H
    [item_id] => 4
    [sku] => 2-hr-sesh
    [url] => 0
    [lock] => 1
    [visibility] => *
    [name] => Two hour session
    [pos] => 0
    [summary] =>
    [details] =>
    [meta] => Array
    (
    [default_len] => 2
    [display_mode] => dropdown
    [item_package_rate] =>
    [delay] => 0
    )
    
    [stock] => 100
    [unlimited] => 0
    [video] => Array
    (
    [id] =>
    [start] => 0
    )
    
    [image] => Array
    (
    )
    
    [category_id] => 1
    [rated] => 1
    [type] => I
    [status] => A
    [alias_id] => 0
    [len] => 2
    [rules] => {"param":{"adult":{"MIN":"0","MAX":"100"},"child":{"MIN":"0","MAX":"100"},"student":{"MIN":"0","MAX":"100"},"socks":{"MIN":"0","MAX":"0"}},"fixed":{"start_time":""}}
    [category] => General Admission
    [param] => Array
    (
    [adult] => Array
    (
    [price] => 1
    [lbl] => Adult
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [def] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [child] => Array
    (
    [price] => 1
    [lbl] => Child
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [student] => Array
    (
    [price] => 1
    [lbl] => Student
    [range] => 1
    [qty] => 0
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 1
    [MIN] => 0
    [MAX] => 100
    )
    
    [socks] => Array
    (
    [price] => 1
    [lbl] => Socks
    [range] => 1
    [qty] => 1
    [req] => 0
    [hide] => 0
    [customer_hide] => 0
    [lock] => 0
    [def] => 1
    [MIN] => 0
    [MAX] => 0
    )
    
    )
    
    [qty] => 1
    [rate] => Array
    (
    [status] => AVAILABLE
    [available] => 100
    [slip] =>
    [summary] => Array
    (
    [title] => Available
    [details] => Adult: 1 @ $15.00
    Socks: 1 @ $2.00
    [price] => Array
    (
    [total] => $17.00
    [title] => $2.00 - $15.00
    [unit] =>
    [param] => Array
    (
    [adult] => $15.00
    [child] => $10.00
    [student] => $11.50
    [socks] => $2.00
    )
    
    )
    
    [date] => Wed Jul 27, 2016
    )
    
    [sub_total] => 17.00
    [event] => Array
    (
    [0] => Array
    (
    [adult] => Array
    (
    [amount] => 15.00
    [days] => 1
    [hours] => 0
    )
    
    [child] => Array
    (
    [amount] => 10.00
    [days] => 1
    [hours] => 0
    )
    
    [student] => Array
    (
    [amount] => 11.50
    [days] => 1
    [hours] => 0
    )
    
    [socks] => Array
    (
    [amount] => 2.00
    [days] => 1
    [hours] => 0
    )
    
    )
    
    )
    
    [start_time] => 09:00 AM
    [end_time] => 11:00 AM
    [start_date] => 20160727
    [end_date] => 20160727
    [dates] => Array
    (
    [20160727] => Array
    (
    [status] => A
    [price] => Array
    (
    [adult] => 15.00
    [child] => 10.00
    [student] => 11.50
    [socks] => 2.00
    )
    
    [dow] => 3
    [stock] => Array
    (
    [T] => 100
    [B] => 0
    [A] => 100
    )
    
    [times] => Array
    (
    [09:00] => Array
    (
    [A] => 100
    )
    
    [10:00] => Array
    (
    [A] => 100
    )
    
    [11:00] => Array
    (
    [A] => 100
    )
    
    [12:00] => Array
    (
    [A] => 100
    )
    
    [13:00] => Array
    (
    [A] => 100
    )
    
    [14:00] => Array
    (
    [A] => 100
    )
    
    [15:00] => Array
    (
    [A] => 100
    )
    
    [16:00] => Array
    (
    [A] => 100
    )
    
    [17:00] => Array
    (
    [A] => 100
    )
    
    [18:00] => Array
    (
    [A] => 100
    )
    
    [19:00] => Array
    (
    [A] => 100
    )
    
    )
    
    [hours] => Array
    (
    [adult] => 2
    [child] => 2
    [student] => 2
    [socks] => 2
    )
    
    )
    
    )
    
    )
    
    [hours] => 2
    [fixed] => Array
    (
    [end_time] => 1
    )
    
    [days] => 1
    [gprice] => Array
    (
    )
    
    [local_start_date] => 27/07/2016
    [local_end_date] => 27/07/2016
    [start_time] => 09:00
    [end_time] => 11:00
    )
    
    )
    

  • MitchMitch Checkfront Team
    edited June 2016
    It doesn't appear that there should be anything wrong with your query to the API. Are you sending the GET request to the "items" endpoint? What do your start and end date variables contain?

    You can test that it's working in your developer console by pasting in the following query string:
    item?start_date=20160727&end_date=20160727&start_time=1000&end_time=1100&param[adult]=4&param[child]=2


    Cheers,
    Mitch
    Checkfront support team

Sign In or Register to comment.