### PHP SDK Example: Get Product Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md Example of how to use the Voucherify PHP SDK to retrieve product details. It shows API key configuration, client instantiation, and calling the `getProduct` method with a product ID. ```PHP setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ProductsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $productId = 'productId_example'; // string | A Voucherify product ID or source ID. try { $result = $apiInstance->getProduct($productId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductsApi->getProduct: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### List Project Webhooks Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Provides an example of how to list all webhook configurations for a given Voucherify project using the PHP SDK. It covers API key setup and the process of calling the listWebhooks method. ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPIClientApiManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. try { $result = $apiInstance->listWebhooks($projectId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->listWebhooks: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Get Project Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Retrieves an existing project. The documentation includes the method signature, parameter details, return type, authorization methods, and a complete PHP example demonstrating its usage. ```APIDOC getProject($projectId): \OpenAPI\Client\Model\ManagementProjectsGetResponseBody Parameters: - projectId (string): Provide the unique identifier of the project. Return type: [\OpenAPI\Client\Model\ManagementProjectsGetResponseBody](../Model/ManagementProjectsGetResponseBody.md) Authorization: [X-Management-Token](../../README.md#X-Management-Token), [X-Management-Id](../../README.md#X-Management-Id) HTTP request headers: - Content-Type: Not defined - Accept: application/json ``` ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. try { $result = $apiInstance->getProject($projectId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->getProject: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### PHP SDK Example: List Customer Redeemables Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/CustomersApi.md Example demonstrating how to configure the Voucherify PHP SDK and call the `listCustomerRedeemables` method with various parameters. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\CustomersApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $customerId = 'customerId_example'; // string | Unique identifier of a customer represented by an internal customer ID or customer source ID. $limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. $order = new \OpenAPI\Client\Model\ParameterOrderListRedeemables(); // ParameterOrderListRedeemables | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. $startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the events starting after an event with the given ID. $filters = new \OpenAPI\Client\Model\ParameterFiltersListCustomerRedeemables(); // ParameterFiltersListCustomerRedeemables | Filters for listing customer redeemables. try { $result = $apiInstance->listCustomerRedeemables($customerId, $limit, $order, $startingAfterId, $filters); print_r($result); } catch (Exception $e) { echo 'Exception when calling CustomersApi->listCustomerRedeemables: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Get Campaign Template (PHP) Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/TemplatesApi.md Shows how to retrieve a specific campaign template using its ID with the Voucherify PHP SDK. Includes API key setup and example usage. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiTemplatesApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $campaignTemplateId = 'campaignTemplateId_example'; // string | Pass the campaign template ID that was assigned by Voucherify. try { $result = $apiInstance->getCampaignTemplate($campaignTemplateId); print_r($result); } catch (Exception $e) { echo 'Exception when calling TemplatesApi->getCampaignTemplate: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### List Products with PHP SDK Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md Demonstrates how to configure API keys and list products using the Voucherify PHP SDK. It shows how to set up authentication, instantiate the ProductsApi client, and make a request to the listProducts endpoint with optional parameters like limit, page, order, startDate, and endDate. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiProductsApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. $page = 56; // int | Which page of results to return. The lowest value is 1. $order = new OpenAPIClientModelParameterOrder(); // ParameterOrder | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. $startDate = new DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. $endDate = new DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Timestamp representing the date and time which results must end on. Represented in ISO 8601 format. try { $result = $apiInstance->listProducts($limit, $page, $order, $startDate, $endDate); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductsApi->listProducts: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### PHP: Delete Category Example Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/CategoriesApi.md Shows how to delete a category using its ID with the Voucherify PHP SDK. This example covers API key configuration, client setup, and executing the `deleteCategory` method. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiCategoriesApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $categoryId = 'categoryId_example'; // string | Unique category ID assigned by Voucherify. try { $apiInstance->deleteCategory($categoryId); } catch (Exception $e) { echo 'Exception when calling CategoriesApi->deleteCategory: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Create Project Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Shows how to create a new project using the Voucherify PHP SDK. This includes setting up API authentication, initializing the Management API, and calling the `createProject` method with project details. ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPIClientApiManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $managementProjectsCreateRequestBody = new OpenAPIClientModelManagementProjectsCreateRequestBody(); // OpenAPIClientModelManagementProjectsCreateRequestBody | Define project details. try { $result = $apiInstance->createProject($managementProjectsCreateRequestBody); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->createProject: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Create SKU for a Product Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md Demonstrates how to create a SKU for a given product using the Voucherify PHP SDK. It includes configuration for API keys, setting up the API client, and making the `createSku` call with product details. Error handling for the API call is also shown. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiProductsApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $productId = 'productId_example'; // string | A Voucherify product ID or product source ID. $productsSkusCreateRequestBody = {"source_id":"first_product_sku_1","sku":"Samsung phone 256GB","price":1300,"currency":"USD","attributes":{"color":"vintage-black","memory":"256","processor":"Intel"},"image_url":"https://www.website.com/image.png","metadata":{"imported":true}}; try { $result = $apiInstance->createSku($productId, $productsSkusCreateRequestBody); print_r($result); } catch (Exception $e) { echo 'Exception when calling ProductsApi->createSku: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Get Voucherify Category (PHP) Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/CategoriesApi.md Example of how to retrieve a specific category using the Voucherify PHP SDK. This involves configuring API keys and calling the `getCategory` method. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\CategoriesApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $categoryId = 'categoryId_example'; // string | Unique category ID assigned by Voucherify. try { $result = $apiInstance->getCategory($categoryId); print_r($result); } catch (Exception $e) { echo 'Exception when calling CategoriesApi->getCategory: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Products API Documentation Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md API documentation for the Voucherify Products API, detailing methods for managing products and SKUs. Includes parameter descriptions, return types, authorization methods, and HTTP headers. ```APIDOC createSku($productId, $productsSkusCreateRequestBody) Description: Creates a SKU for a product. Parameters: - productId (string): A Voucherify product ID or product source ID. - productsSkusCreateRequestBody (OpenAPI\Client\Model\ProductsSkusCreateRequestBody): Specify the SKU parameters to be created. [optional] Return type: OpenAPI\Client\Model\ProductsSkusCreateResponseBody Authorization: [X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) HTTP request headers: - Content-Type: application/json - Accept: application/json deleteProduct($productId, $force) Description: Deletes a product and all related SKUs. This operation cannot be undone. If the force parameter is set to false or not set at all, the product and all related SKUs will be moved to the bin. Parameters: - productId (string): A Voucherify product ID or source ID. - force (bool): If this flag is set to true, the product and all related SKUs will be removed permanently. If it is set to false or not set at all, the product and all related SKUs will be moved to the bin. Going forward, the user will be able to create another product with exactly the same source_id. [optional] Authorization: [X-App-Id](../../README.md#X-App-Id), [X-App-Token](../../README.md#X-App-Token) HTTP request headers: - Content-Type: application/json - Accept: application/json ``` -------------------------------- ### Get Metadata Schema Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Retrieves a specific metadata schema for a given project. Includes configuration for API key authorization and an example of how to instantiate the ManagementApi client and call the getMetadataSchema1 method. ```APIDOC getMetadataSchema1($projectId, $metadataSchemaId): \OpenAPI\Client\Model\ManagementProjectsMetadataSchemasGetResponseBody Parameters: - projectId (string): Provide the unique identifier of the project. - metadataSchemaId (string): Provide the unique identifier of the metadata schema. Return type: [\OpenAPI\Client\Model\ManagementProjectsMetadataSchemasGetResponseBody](../Model/ManagementProjectsMetadataSchemasGetResponseBody.md) Authorization: [X-Management-Token](../../README.md#X-Management-Token), [X-Management-Id](../../README.md#X-Management-Id) HTTP request headers: - Content-Type: Not defined - Accept: application/json ``` ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. $metadataSchemaId = 'metadataSchemaId_example'; // string | Provide the unique identifier of the metadata schema. try { $result = $apiInstance->getMetadataSchema1($projectId, $metadataSchemaId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->getMetadataSchema1: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### List Campaign Templates Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/TemplatesApi.md Demonstrates how to configure API keys and call the `listCampaignTemplates` method from the Voucherify PHP SDK. It includes setting API credentials, defining parameters like limit, startingAfterId, order, includeTotal, and filters, and handling potential exceptions. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiTemplatesApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. $startingAfterId = 'startingAfterId_example'; // string | A cursor for pagination. It retrieves the campaign templates created after a template with the given ID. $order = new OpenAPIClientModelParameterTemplatesList(); // ParameterTemplatesList | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. $includeTotal = True; // bool | If set to true, the response returns the number of all campaign templates, regardless of the applied filters or limits. Set to false by default. $filters = new OpenAPIClientModelParameterFiltersListTemplates(); // ParameterFiltersListTemplates | Filters for listing templates. try { $result = $apiInstance->listCampaignTemplates($limit, $startingAfterId, $order, $includeTotal, $filters); print_r($result); } catch (Exception $e) { echo 'Exception when calling TemplatesApi->listCampaignTemplates: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Update User Role Example Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Demonstrates how to update a user's role in a project using the Voucherify PHP SDK. Includes API key setup and the execution of the updateUser method. ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPIClientApi\ManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. $userId = 'userId_example'; // string | Provide the unique identifier of the user. Alternatively, provide the users login. $managementProjectsUsersUpdateRoleRequestBody = new OpenAPIClientModelManagementProjectsUsersUpdateRoleRequestBody(); // OpenAPIClientModelManagementProjectsUsersUpdateRoleRequestBody | Defines the users new role. try { $result = $apiInstance->updateUser($projectId, $userId, $managementProjectsUsersUpdateRoleRequestBody); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->updateUser: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### List Loyalty Tiers Example Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/LoyaltiesApi.md Demonstrates how to configure API keys and list loyalty tiers using the Voucherify PHP SDK. It shows setting up authentication and making a request to the `listLoyaltyTiers` method with parameters for campaign ID, limit, and order. ```php setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiLoyaltiesApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $campaignId = 'campaignId_example'; // string | Unique loyalty campaign ID or name. $limit = 56; // int | Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. $order = new OpenAPIClientModelParameterOrderListLoyaltyTiers(); // ParameterOrderListLoyaltyTiers | Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order. try { $result = $apiInstance->listLoyaltyTiers($campaignId, $limit, $order); print_r($result); } catch (Exception $e) { echo 'Exception when calling LoyaltiesApi->listLoyaltyTiers: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### List Projects using Management API Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Demonstrates how to configure API keys and use the Management API to list all projects. Includes error handling for the API call. ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPIClientApiManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); try { $result = $apiInstance->listProjects(); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->listProjects: ', $e->getMessage(), PHP_EOL; } ?> ``` -------------------------------- ### Voucherify API: Get Stacking Rules Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Retrieves the stacking rules for a specific project using the Voucherify PHP SDK. Requires project and stacking rules IDs. Includes example usage and parameter details. ```APIDOC getStackingRules($projectId, $stackingRulesId) Retrieves the stacking rules for the project. Parameters: projectId (string): Provide the unique identifier of the project. stackingRulesId (string): Provide the unique identifier of the stacking rules. Return type: \OpenAPI\Client\Model\ManagementProjectsStackingRulesGetResponseBody HTTP request headers: Content-Type: Not defined Accept: application/json Authorization: X-Management-Token X-Management-Id ``` ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. $stackingRulesId = 'stackingRulesId_example'; // string | Provide the unique identifier of the stacking rules. try { $result = $apiInstance->getStackingRules($projectId, $stackingRulesId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->getStackingRules: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Voucherify API: Get User Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Retrieves details for a specific user within a project using the Voucherify PHP SDK. Requires project and user IDs. Includes example usage, parameter descriptions, and return types. ```APIDOC getUser($projectId, $userId) Retrieves the project users details. Parameters: projectId (string): Provide the unique identifier of the project. userId (string): Provide the unique identifier of the user. Alternatively, provide the users login. Return type: \OpenAPI\Client\Model\ManagementProjectsUsersGetUserResponseBody HTTP request headers: Content-Type: Not defined Accept: application/json Authorization: X-Management-Token X-Management-Id ``` ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPI\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPI\Client\Api\ManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. $userId = 'userId_example'; // string | Provide the unique identifier of the user. Alternatively, provide the users login. try { $result = $apiInstance->getUser($projectId, $userId); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->getUser: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Products API - APIDOC Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md Provides documentation for the Products API endpoints, including methods for listing products and importing SKUs. ```APIDOC importSkusUsingCsv($file): \OpenAPI\Client\Model\SkusImportCsvCreateResponseBody Import SKUs using CSV Imports SKUs into the repository using a CSV file. The CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. This API request starts a process that affects Voucherify data in bulk. The result will return the async ID. You can verify the status of your request via this API request. Parameters: file: \SplFileObject | File path. [optional] Return type: \OpenAPI\Client\Model\SkusImportCsvCreateResponseBody Authorization: X-App-Id, X-App-Token HTTP request headers: Content-Type: multipart/form-data Accept: application/json listProducts($limit, $page, $order, $startDate, $endDate): \OpenAPI\Client\Model\ProductsListResponseBody List Products Retrieve a list of products. Parameters: limit: int | Number of products to be returned in the response. page: int | Page number of the products to be returned in the response. order: string | Specify the order of products received. Use ASC or DESC. startDate: string | Use this query parameter to receive products created after or on this date. The date format is ISO 8601 yyyy-MM-dd'T'HH:mm:ssZ. endDate: string | Use this parameter to receive products created before or on this date. The date format is ISO 8601 yyyy-MM-dd'T'HH:mm:ssZ. Return type: \OpenAPI\Client\Model\ProductsListResponseBody Authorization: X-App-Id, X-App-Token HTTP request headers: Accept: application/json ``` -------------------------------- ### Get Metadata Schema Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/MetadataSchemasApi.md Retrieves a metadata schema for a specific resource type, supporting both standard and custom schemas. Includes detailed parameter descriptions, return types, authorization methods, and an example of how to use the method in PHP. ```PHP setApiKey('X-App-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Id', 'Bearer'); // Configure API key authorization: X-App-Token $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-App-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-App-Token', 'Bearer'); $apiInstance = new OpenAPIClientApiMetadataSchemasApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $resource = 'resource_example'; // string | There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. try { $result = $apiInstance->getMetadataSchema($resource); print_r($result); } catch (Exception $e) { echo 'Exception when calling MetadataSchemasApi->getMetadataSchema: ', $e->getMessage(), PHP_EOL; } ?> /** * Get Metadata Schema * * Retrieves a metadata schema per resource type. * * @param string $resource There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. (required) * * @return \OpenAPI\Client\Model\MetadataSchemasGetResponseBody * @throws \ApiException If call failed */ public function getMetadataSchema($resource) ``` -------------------------------- ### PHP SDK Example: Update Webhook Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ManagementApi.md Example demonstrating how to use the Voucherify PHP SDK to update a webhook. It includes configuration for API key authorization, instantiation of the ManagementApi client, and making the updateWebhook call with example parameters. ```php setApiKey('X-Management-Token', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Token', 'Bearer'); // Configure API key authorization: X-Management-Id $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKey('X-Management-Id', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // $config = OpenAPIClientConfiguration::getDefaultConfiguration()->setApiKeyPrefix('X-Management-Id', 'Bearer'); $apiInstance = new OpenAPIClientApiManagementApi( // If you want use custom http client, pass your client which implements `GuzzleHttpClientInterface`. // This is optional, `GuzzleHttpClient` will be used as default. new GuzzleHttpClient(), $config ); $projectId = 'projectId_example'; // string | Provide the unique identifier of the project. $webhookId = 'webhookId_example'; // string | Provide the unique identifier of the webhook configuration. $managementProjectsWebhooksUpdateRequestBody = new OpenAPIClientModelManagementProjectsWebhooksUpdateRequestBody(); // OpenAPIClientModelManagementProjectsWebhooksUpdateRequestBody | Defines the webhook configuration to be updated. try { $result = $apiInstance->updateWebhook($projectId, $webhookId, $managementProjectsWebhooksUpdateRequestBody); print_r($result); } catch (Exception $e) { echo 'Exception when calling ManagementApi->updateWebhook: ', $e->getMessage(), PHP_EOL; } ``` -------------------------------- ### Voucherify API: Products Source: https://github.com/voucherifyio/voucherify-php-sdk/blob/master/docs/Api/ProductsApi.md API documentation for the Products endpoint, detailing the `listProducts` method. It includes parameter descriptions, return types, authorization methods, and HTTP headers. ```APIDOC APIDOC: ProductsApi: listProducts(limit: int, page: int, order: ParameterOrder, startDate: DateTime, endDate: DateTime): ProductsListResponseBody Description: Lists products with filtering and sorting options. Parameters: limit (int): Limits the number of objects to be returned. Range: 1-100. Default: 10. page (int): Page number for results. Minimum: 1. order (ParameterOrder): Sorting options. Prefix with '-' for descending order. startDate (DateTime): Timestamp for filtering results ending on or before this date (ISO 8601 format). endDate (DateTime): Timestamp for filtering results ending on or before this date (ISO 8601 format). Return Type: ProductsListResponseBody Authorization: X-App-Id, X-App-Token HTTP Headers: Accept: application/json ```