Skip to content

Instantly share code, notes, and snippets.

@tristansokol
Created July 26, 2017 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tristansokol/ed7d2c00be9ba2bf3ad59ec8bb066cc5 to your computer and use it in GitHub Desktop.
Save tristansokol/ed7d2c00be9ba2bf3ad59ec8bb066cc5 to your computer and use it in GitHub Desktop.
<?php
$api_instance = new SquareConnect\Api\CatalogApi();
$body = array(
'idempotency_key'=>uniqid(),
'object'=>array(
'type'=>'ITEM',
'id'=>'#temp-item-id',
'item_data'=>array(
'name'=>'Brass Tube',
'description'=>'Great for models',
'variations'=>array(
array(
'type'=>'ITEM_VARIATION',
'id'=>'#var0',
'item_variation_data'=>array(
'item_id'=>'#temp-item-id',
'name'=>'15 cm',
'pricing_type'=>'VARIABLE_PRICING'
)
),
array(
'type'=>'ITEM_VARIATION',
'id'=>'#var1',
'item_variation_data'=>array(
'item_id'=>'#temp-item-id',
'name'=>'30 cm',
'pricing_type'=>'VARIABLE_PRICING'
)
)
)
)
)
);
$result = $api_instance->upsertCatalogObject($body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment