-
Notifications
You must be signed in to change notification settings - Fork 4
Products Create
Brad Ploeger edited this page Apr 3, 2019
·
1 revision
Creates a new product
$rezdyApi->products->create($request);- Rezdy\Requests\Product: $request
- none
use Rezdy\RezdyAPI;
use Rezdy\Requests\Product;
use Rezdy\Requests\Objects\PriceOption;
// Initialize the API
$rezdyAPI = new RezdyAPI('your api key');
$productParams = [
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
'durationMinutes' => 60,
'name' => 'Product Created From API',
'productType' => 'ACTIVITY',
'shortDescription' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
'advertisedPrice' => 99.95,
'confirmMode' => 'AUTOCONFIRM',
'internalCode' => 'API-TEST-ITEM',
'quantityRequired' => true,
'terms' => 'Custom Terms and Conditions' ];
$priceOptionParams = [
'label' => 'Adult',
'price' => 99.95,
'priceGroupType' => 'EACH',
'seatsUsed' => 1 ];
// Create the Product request
$product = new Product($productParams);
// Create the PriceOption request
$priceOption = new PriceOption($priceOptionParams);
// Add the PriceOption request to the Product request
$product->attach($priceOption);
// Send the Product request to the API
$response = $rezdyAPI->products->create($product);
// View the response
echo $response;Rezdy API V1 PHP Wrapper