rspective/voucherify

Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details.


README

Voucherify empowers marketers and developers with flexible building blocks to come up with, implement, and track targeted promotional campaigns.

Learn more about Voucherify by visiting our site.

This SDK is automatically generated by the OpenAPI Generator based on our Documentation with v2018-08-01 version.

The legacy version of Java SDK could be found here

๐Ÿ“ Documentation

You will find detailed description and example responses at our official documentation. Most method headers point to more detailed descriptions of arguments you can use.

๐Ÿ“š Want to learn more? Visit our official site or our Success Portal.

๐Ÿ‘ฝ Having troubles? Check our Help center.

๐Ÿงช Looking for promotion ideas? Check our Cookbook to get an inspiration.

๐Ÿ› Encounter a bug? Please file a report in the Issues.

โœ… Supported endpoint can be found here

Requirements

PHP 8.1 and later.

Installation

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
    }
  ],
  "require": {
    "GIT_USER_ID/GIT_REPO_ID": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

<?php
require_once('/path/to/OpenAPIClient-php/vendor/autoload.php');

๐Ÿš€ Running code

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');



// Configure API key authorization: X-App-Id
$config = OpenAPI\Client\Configuration::getDefaultConfiguration()->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\AsyncActionsApi(
    // 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
);
$asyncActionId = 'asyncActionId_example'; // string | Unique ID of the asynchronous operation.

try {
    $result = $apiInstance->getAsyncAction($asyncActionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling AsyncActionsApi->getAsyncAction: ', $e->getMessage(), PHP_EOL;
}

It may be useful to check the test implementation in the folder test (./__test__)

๐Ÿณ Running local tests with docker

  1. Copy .env.example to .env and fill in the values.
  2. Run docker build -t php . to build the image.
  3. Run docker run --rm php to run the tests and delete container immediately after.

๐Ÿ› ๏ธ Contributing

Read more about how to Contribute to Voucherify Java SDK by visiting main repo GENERATING-SDKS.md

Remember that this SDK is auto generated (except of the tests) so changes made here will be overwritten by generator.

๐Ÿ“… Changelog

  • 2024-11-04 - 5.0.1
    • Added support for returning campaign_id and campaign_name in stackable validation endpoint, when redeemable option is expanded
  • 2024-10-28 - 5.0.0
    • Added missing enums in few filters models
    • !!! BREAKING CHANGES !!!
      • VouchersApi.generateRandomCode now requires VouchersCreateResponseBody instead of plain object
      • property product in model Discount now uses DiscountProduct instead of SimpleProductDiscountUnit
      • property filters of model ExportsCreateRequestBodyParameters now uses plain object instead of ExportsCreateRequestBodyParametersFilters
  • 2024-10-25 - 4.0.0
    • Fix object parsing in query. For example filters while listing redemptions.
    • Fix downloading exports. Include auth headers in the call.
    • !!! BREAKING CHANGES !!!
      • Remove support for /v1/customers/{customerId}/consents - put Update Customer's consents [Deprecated]
      • Remove support for /v1/consents - get List Consents [Deprecated]
      • Remove support for /client/v1/customers/{customerId}/consents - put Update Customer's consents (client-side) [Deprecated]
      • Pagination changed on listing card transactions(listLoyaltyCardTransactions) - NO page param is supported - use starting_after_id instead.
      • Pagination changed on listing voucher transactions(listVoucherTransactions) - NO page param is supported - use starting_after_id instead.
      • ApplicableToEffect - changed - EVERY -> TO_EVERY, CHEAPEST -> TO_CHEAPEST, MOST_EXPENSIVE -> TO_MOST_EXPENSIVE, 2 new values introduced.
      • listPublications parameter filters have changed - now uses ParameterFiltersListPublications instead of String
      • ParameterFiltersListRedemptions and ParameterFiltersListCustomerRedeemables have been updated
      • enum LUCKY_DRAW, LUCKY_DRAW_CODE, VOUCHER_LUCKY_DRAW_CODE, CAMPAIGN_LUCKY_DRAW have been deleted from everywhere and no longer supported
      • CampaignsUpdateRequestBody - properties activityDurationAfterPublishing, joinOnce, autoJoin, type, uniqueWinners, uniqueWinnersPerDraw and enum AUTO_UPDATE | STATIC have been deleted and no longer supported
      • updateCustomersConsents has been deleted and no longer supported
      • FilterConditionsDateTimeConditions model has been renamed to FilterConditionsDateTime
      • FilterConditionsDateTime - conditions has been divided on $after, $before, $hasValue, $isUnknown, moreThan, lessThan properties
      • ParamterFiltersListCustomerRedeemables - model name of createdAt has been renamed from FilterConditionsDateTime to ParameterFiltersListCustomerRedeemablesCreatedAt
      • filter property in schemas ProductCollectionsCreateRequestBody, ProductCollectionsCreateResponseBody, ProductCollectionsItem and ProductCollectionsGetResponseBody has changed. Uses plain object.
      • discount property in schema CampaignsUpdateRequestBody now uses Discount model
      • properties winnersCount, uniqueWinnersPerDraw, uniqueWinners in model CampaignsUpdateRequestBody were deleted.
      • property stackingRulesType were deleted from models CategoriesGetResponseBody, Category
      • property categories in model ClientValidationsValidateResponseBodyRedeemablesItem uses now Array model
      • model ParameterFiltersListCustomerRedeemablesCampaignId has been fixed, can use junction properly.
      • model ParameterFiltersListRedemptions has been fixed, can use junction properly.
      • property filter in model ProductCollectionsCreateRequestBody now uses plain Object
      • property categories in model QualificationsRedeemable now uses Array<CategoryWithStackingRulesType>
    • Added support:
      • /v1/metadata-schemas - get List Metadata Schemas
      • /v1/metadata-schemas/{resource} - get Get Metadata Schema
      • /v1/locations - List Locations
      • /v1/locations/{locationId} - get Get Location
      • /v1/referrals/{campaignId}/members/{memberId}/holders - post Add Referral Code Holders
      • /v1/referrals/{campaignId}/members/{memberId}/holders - get List Referral Code Holders
      • /v1/referrals/{campaignId}/members/{memberId}/holders/{holderId} - delete Remove Referral Card Holder
      • /v1/referrals/members/{memberId}/holders - post Add Referral Code Holders
      • /v1/referrals/members/{memberId}/holders - get List Referral Code Holders
      • /v1/referrals/members/{memberId}/holders/{holderId} - delete Remove Referral Card Holder
      • /v1/trash-bin - get List Bin Entries
      • /v1/trash-bin/{binEntryId} - delete Delete Bin Entry
      • /v1/templates/campaigns - get List Campaign Templates
      • /v1/templates/campaigns - post Create Campaign Template
      • /v1/templates/campaigns/{campaignTemplateId} - get Get Campaign Template
      • /v1/templates/campaigns/{campaignTemplateId} - put Update Campaign Template
      • /v1/templates/campaigns/{campaignTemplateId} - delete Delete Campaign Template
      • /v1/templates/campaigns/{campaignTemplateId}/campaign-setup - post Create Campaign From Template
      • /v1/templates/campaigns/{campaignTemplateId}/tier-setup - post Add Promotion Tier From Template
      • /management/v1/projects - post Create Project
      • /management/v1/projects - get List Projects
      • /management/v1/projects/{projectId} - get Get Project
      • /management/v1/projects/{projectId} - put Update Project
      • /management/v1/projects/{projectId} - delete Delete Project
      • /management/v1/projects/{projectId}/users - post Assign User
      • /management/v1/projects/{projectId}/users/{userId} - put Update User
      • /management/v1/projects/{projectId}/users/{userId} - delete Unassign User
      • /management/v1/projects/users/invite - post Invite a New User
      • /management/v1/projects/{projectId}/templates/campaigns - get List Campaign Templates
      • /management/v1/projects/{projectId}/templates/campaigns/{campaignTemplateId}/copy - post Copy Campaign Template to a Project
      • /management/v1/projects/{projectId}/stacking-rules - post Create Stacking Rules
      • /management/v1/projects/{projectId}/stacking-rules - get List Stacking Rules
      • /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} - get Get Stacking Rules
      • /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} - put Update Stacking Rules
      • /management/v1/projects/{projectId}/stacking-rules/{stackingRulesId} - delete Delete Stacking Rules
      • /management/v1/projects/{projectId}/metadata-schemas - post Create Metadata Schema
      • /management/v1/projects/{projectId}/metadata-schemas - get List Metadata Schemas
      • /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} - get Get Metadata Schema
      • /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} - put Update Metadata Schema
      • /management/v1/projects/{projectId}/metadata-schemas/{metadataSchemaId} - delete Delete Metadata Schema
      • /management/v1/projects/{projectId}/custom-event-schemas - post Create Custom Event Schema
      • /management/v1/projects/{projectId}/custom-event-schemas - get List Custom Event Schemas
      • /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} - get Get Custom Event Schema
      • /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} - put Update Custom Event Schema
      • /management/v1/projects/{projectId}/custom-event-schemas/{customEventSchemaId} - delete Delete Custom Event Schema
      • /management/v1/projects/{projectId}/webhooks - post Create Webhook
      • /management/v1/projects/{projectId}/webhooks - get List Webhooks
      • /management/v1/projects/{projectId}/webhooks/{webhookId} - get Get Webhook
      • /management/v1/projects/{projectId}/webhooks/{webhookId} - put Update Webhook
      • /management/v1/projects/{projectId}/webhooks/{webhookId} - delete Delete Webhook
      • /management/v1/projects/{projectId}/branding - post Create Brand
      • /management/v1/projects/{projectId}/branding - get List Brands
      • /management/v1/projects/{projectId}/branding/{brandingId} - get Get Brand
      • /management/v1/projects/{projectId}/branding/{brandingId} - put Update Brand
      • /management/v1/projects/{projectId}/branding/{brandingId} - delete Delete Brand
  • 2024-09-11 - 3.0.0
    • The new version of the SDK includes coverage for all the most commonly used Voucherify endpoints and supports typed models.

Previous versions of the API are no longer supported, and we highly recommend upgrading to version 3.0.0, which is now designated as Long-Term Support (LTS).

API Endpoints

All URIs are relative to https://api.voucherify.io

Models

Authorization

X-App-Id

  • Type: API key
  • API key parameter name: X-App-Id
  • Location: HTTP header

X-App-Token

  • Type: API key
  • API key parameter name: X-App-Token
  • Location: HTTP header

X-Client-Token

  • Type: API key
  • API key parameter name: X-Client-Token
  • Location: HTTP header

X-Client-Application-Id

  • Type: API key
  • API key parameter name: X-Client-Application-Id
  • Location: HTTP header

X-Management-Id

  • Type: API key
  • API key parameter name: X-Management-Id
  • Location: HTTP header

X-Management-Token

  • Type: API key
  • API key parameter name: X-Management-Token
  • Location: HTTP header

Author

support@voucherify.io

About this package

This PHP package is automatically generated by the OpenAPI Generator project:

  • API version: v2018-08-01
    • Package version: 5.0.1
  • Build package: org.openapitools.codegen.languages.PhpNextgenClientCodegen