PHP code example of nickcheek / mckesson

1. Go to this page and download the library: Download nickcheek/mckesson library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nickcheek / mckesson example snippets


$search = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $search->search('Tena Underwear');
var_dump($result);

$search = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $search->lookup('978841',null, 'refinement');
var_dump($result);

$search = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $search->lookup('978841', null, 'refinement', 16873);
var_dump($result);

$lookup = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $lookup->lookup('978841');
var_dump($result);

$lookup = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $lookup->lookup('978841','extra');
var_dump($result);

$feed = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $feed->feed('foo','list', 802115, 'detail availability');
var_dump($result);

//first you will need to setup the ,
    'total' => '12.00',
    'customerName' => 'Nicholas Cheek',
    'address1' => '123 Anystreet Dr',
    'address2' => 'Suite F', //optional
    'city' => 'Little Rock',
    'state' => 'AR',
    'zip' => 72019,
    'phone' => '5011234567', //optional
    'email' => '[email protected]', //optional (*i think*)
    'customerId' => 12345
    ];

$item1 = [
    'qty' => 2,
    'sku' => 123456,
    'price' => '12.00',
    'uom' => 'BX'
];

$item2 = [
    'qty' => 2,
    'sku' => 78901,
    'price' => '12.00',
    'uom' => 'BX'
];

$order = [$item1, $item2];

$order = new Mckesson($identity, $secret, $account_number, $b2b_key);
$result = $order->order($customer, $order) // or whatever you're searching
var_dump($result);

//You can use the builder to make it easy to build up items and customers.
$builder = new Mckesson($identity, $secret, $account_number, $b2b_key);
$items = $builder->addItem(2, '123456','12.00','BX');
$items = $builder->addItem(1, '23939291','23.00','EA');
$items = $builder->addItem(19, '8328237','83.00','CS');
$customer = $builder->addCustomer(12345,'23.00','nick cheek','201 MyStreet Ave', '', 'Little Rock', 'AR',72204,'','',123456778);

//afterwards, you can order like so:
$order = $builder->order($customer, $items);