Skip to content

voucherifyio/voucherify-php-sdk

Repository files navigation

OpenAPIClient-php

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

For more information, please visit https://www.voucherify.io/contact-support.

Installation & Usage

Requirements

PHP 8.1 and later.

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');

Getting Started

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;
}

API Endpoints

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

Class Method HTTP request Description
AsyncActionsApi getAsyncAction GET /v1/async-actions/{asyncActionId} Get Async Action
AsyncActionsApi listAsyncActions GET /v1/async-actions List Async Actions
CampaignsApi addVoucherWithSpecificCodeToCampaign POST /v1/campaigns/{campaignId}/vouchers/{code} Add Voucher with Specific Code to Campaign
CampaignsApi addVouchersToCampaign POST /v1/campaigns/{campaignId}/vouchers Add Vouchers to Campaign
CampaignsApi createCampaign POST /v1/campaigns Create Campaign
CampaignsApi deleteCampaign DELETE /v1/campaigns/{campaignId} Delete Campaign
CampaignsApi disableCampaign POST /v1/campaigns/{campaignId}/disable Disable Campaign
CampaignsApi enableCampaign POST /v1/campaigns/{campaignId}/enable Enable Campaign
CampaignsApi getCampaign GET /v1/campaigns/{campaignId} Get Campaign
CampaignsApi importVouchersToCampaign POST /v1/campaigns/{campaignId}/import Import Vouchers to Campaign
CampaignsApi importVouchersToCampaignUsingCsv POST /v1/campaigns/{campaignId}/importCSV Import Vouchers to Campaign by CSV
CampaignsApi listCampaigns GET /v1/campaigns List Campaigns
CampaignsApi updateCampaign PUT /v1/campaigns/{campaignId} Update Campaign
CategoriesApi createCategory POST /v1/categories Create Category
CategoriesApi deleteCategory DELETE /v1/categories/{categoryId} Delete Category
CategoriesApi getCategory GET /v1/categories/{categoryId} Get Category
CategoriesApi listCategories GET /v1/categories List Categories
CategoriesApi updateCategory PUT /v1/categories/{categoryId} Update Category
ClientSideApi checkEligibilityClientSide POST /client/v1/qualifications Check Eligibility (client-side)
ClientSideApi listPromotionTiersClientSide GET /client/v1/promotions/tiers List Promotion Tiers (client-side)
ClientSideApi redeemStackedDiscountsClientSide POST /client/v1/redemptions Redeem Stackable Discounts (client-side)
ClientSideApi trackCustomEventClientSide POST /client/v1/events Track Custom Event (client-side)
ClientSideApi validateStackedDiscountsClientSide POST /client/v1/validations Validate Stackable Discounts (client-side)
CustomersApi createCustomer POST /v1/customers Create Customer
CustomersApi customerPermanentlyDeletion POST /v1/customers/{customerId}/permanent-deletion Delete Customer Permanently
CustomersApi deleteCustomer DELETE /v1/customers/{customerId} Delete Customer
CustomersApi getCustomer GET /v1/customers/{customerId} Get Customer
CustomersApi importCustomersUsingCsv POST /v1/customers/importCSV Import and Update Customers using CSV
CustomersApi listCustomerActivity GET /v1/customers/{customerId}/activity List Customer Activity
CustomersApi listCustomerRedeemables GET /v1/customers/{customerId}/redeemables List Customer's Redeemables
CustomersApi listCustomerSegments GET /v1/customers/{customerId}/segments List Customer's Segments
CustomersApi listCustomers GET /v1/customers List Customers
CustomersApi updateCustomer PUT /v1/customers/{customerId} Update Customer
CustomersApi updateCustomersConsents PUT /v1/customers/{customerId}/consents Update Customer's consents [Deprecated]
CustomersApi updateCustomersInBulk POST /v1/customers/bulk/async Update Customers in Bulk
CustomersApi updateCustomersMetadataInBulk POST /v1/customers/metadata/async Update Customers' Metadata in Bulk
EventsApi trackCustomEvent POST /v1/events Track Custom Event
ExportsApi createExport POST /v1/exports Create Export
ExportsApi deleteExport DELETE /v1/exports/{exportId} Delete Export
ExportsApi downloadExport GET /v1/exports/{export_Id} Download Export
ExportsApi getExport GET /v1/exports/{exportId} Get Export
ExportsApi listExports GET /v1/exports List Exports
LoyaltiesApi addMember POST /v1/loyalties/{campaignId}/members Add Member
LoyaltiesApi createEarningRule POST /v1/loyalties/{campaignId}/earning-rules Create Earning Rule
LoyaltiesApi createInBulkLoyaltyTiers POST /v1/loyalties/{campaignId}/tiers Create loyalty tiers
LoyaltiesApi createLoyaltyProgram POST /v1/loyalties Create Loyalty Campaign
LoyaltiesApi createPointsExpirationExport POST /v1/loyalties/{campaignId}/points-expiration/export Create Points Expiration Export
LoyaltiesApi createRewardAssignment1 POST /v1/loyalties/{campaignId}/rewards Create Reward Assignment
LoyaltiesApi deleteEarningRule DELETE /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} Delete Earning Rule
LoyaltiesApi deleteLoyaltyProgram DELETE /v1/loyalties/{campaignId} Delete Loyalty Campaign
LoyaltiesApi deleteRewardAssignment1 DELETE /v1/loyalties/{campaignId}/rewards/{assignmentId} Delete Reward Assignment
LoyaltiesApi disableEarningRule POST /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable Disable Earning Rule
LoyaltiesApi enableEarningRule POST /v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable Enable Earning Rule
LoyaltiesApi exportLoyaltyCardTransactions POST /v1/loyalties/members/{memberId}/transactions/export Export Loyalty Card Transactions
LoyaltiesApi exportLoyaltyCardTransactions1 POST /v1/loyalties/{campaignId}/members/{memberId}/transactions/export Export Loyalty Card Transactions
LoyaltiesApi getEarningRule GET /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} Get Earning Rule
LoyaltiesApi getLoyaltyProgram GET /v1/loyalties/{campaignId} Get Loyalty Campaign
LoyaltiesApi getLoyaltyTier GET /v1/loyalties/{campaignId}/tiers/{loyaltyTierId} Get Loyalty Tier
LoyaltiesApi getMember GET /v1/loyalties/members/{memberId} Get Member
LoyaltiesApi getMember1 GET /v1/loyalties/{campaignId}/members/{memberId} Get Member
LoyaltiesApi getRewardAssignment1 GET /v1/loyalties/{campaignId}/reward-assignments/{assignmentId} Get Reward Assignment
LoyaltiesApi getRewardAssignment2 GET /v1/loyalties/{campaignId}/rewards/{assignmentId} Get Reward Assignment
LoyaltiesApi getRewardDetails GET /v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward Get Reward Details
LoyaltiesApi listEarningRules GET /v1/loyalties/{campaignId}/earning-rules List Earning Rules
LoyaltiesApi listLoyaltyCardTransactions GET /v1/loyalties/members/{memberId}/transactions List Loyalty Card Transactions
LoyaltiesApi listLoyaltyCardTransactions1 GET /v1/loyalties/{campaignId}/members/{memberId}/transactions List Loyalty Card Transactions
LoyaltiesApi listLoyaltyPrograms GET /v1/loyalties List Loyalty Campaigns
LoyaltiesApi listLoyaltyTierEarningRules GET /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/earning-rules List Loyalty Tier Earning Rules
LoyaltiesApi listLoyaltyTierRewards GET /v1/loyalties/{campaignId}/tiers/{loyaltyTierId}/rewards List Loyalty Tier Rewards
LoyaltiesApi listLoyaltyTiers GET /v1/loyalties/{campaignId}/tiers List Loyalty Tiers
LoyaltiesApi listMemberActivity GET /v1/loyalties/members/{memberId}/activity List Member Activity
LoyaltiesApi listMemberActivity1 GET /v1/loyalties/{campaignId}/members/{memberId}/activity List Member Activity
LoyaltiesApi listMemberLoyaltyTier GET /v1/loyalties/members/{memberId}/tiers List Member's Loyalty Tiers
LoyaltiesApi listMemberRewards GET /v1/loyalties/members/{memberId}/rewards List Member Rewards
LoyaltiesApi listMembers GET /v1/loyalties/{campaignId}/members List Members
LoyaltiesApi listPointsExpiration GET /v1/loyalties/{campaignId}/members/{memberId}/points-expiration Get Points Expiration
LoyaltiesApi listRewardAssignments1 GET /v1/loyalties/{campaignId}/reward-assignments List Reward Assignments
LoyaltiesApi listRewardAssignments2 GET /v1/loyalties/{campaignId}/rewards List Reward Assignments
LoyaltiesApi redeemReward POST /v1/loyalties/members/{memberId}/redemption Redeem Reward
LoyaltiesApi redeemReward1 POST /v1/loyalties/{campaignId}/members/{memberId}/redemption Redeem Reward
LoyaltiesApi transferPoints POST /v1/loyalties/{campaignId}/members/{memberId}/transfers Transfer Loyalty Points
LoyaltiesApi updateEarningRule PUT /v1/loyalties/{campaignId}/earning-rules/{earningRuleId} Update Earning Rule
LoyaltiesApi updateLoyaltyCardBalance POST /v1/loyalties/members/{memberId}/balance Add or Remove Loyalty Card Balance
LoyaltiesApi updateLoyaltyCardBalance1 POST /v1/loyalties/{campaignId}/members/{memberId}/balance Add or Remove Loyalty Card Balance
LoyaltiesApi updateLoyaltyProgram PUT /v1/loyalties/{campaignId} Update Loyalty Campaign
LoyaltiesApi updateRewardAssignment1 PUT /v1/loyalties/{campaignId}/rewards/{assignmentId} Update Reward Assignment
OrdersApi createOrder POST /v1/orders Create Order
OrdersApi createOrderExport POST /v1/orders/export Create Orders Export
OrdersApi getOrder GET /v1/orders/{orderId} Get Order
OrdersApi importOrders POST /v1/orders/import Import Orders
OrdersApi listOrders GET /v1/orders List Orders
OrdersApi updateOrder PUT /v1/orders/{orderId} Update Order
ProductCollectionsApi createProductCollection POST /v1/product-collections Create Product Collection
ProductCollectionsApi deleteProductCollection DELETE /v1/product-collections/{productCollectionId} Delete Product Collection
ProductCollectionsApi getProductCollection GET /v1/product-collections/{productCollectionId} Get Product Collection
ProductCollectionsApi listProductCollections GET /v1/product-collections List Product Collections
ProductCollectionsApi listProductsInCollection GET /v1/product-collections/{productCollectionId}/products List Products in Collection
ProductsApi createProduct POST /v1/products Create Product
ProductsApi createSku POST /v1/products/{productId}/skus Create SKU
ProductsApi deleteProduct DELETE /v1/products/{productId} Delete Product
ProductsApi deleteSku DELETE /v1/products/{productId}/skus/{skuId} Delete SKU
ProductsApi getProduct GET /v1/products/{productId} Get Product
ProductsApi getSku GET /v1/skus/{skuId} Get SKU
ProductsApi importProductsUsingCsv POST /v1/products/importCSV Import Products using CSV
ProductsApi importSkusUsingCsv POST /v1/skus/importCSV Import SKUs using CSV
ProductsApi listProducts GET /v1/products List Products
ProductsApi listSkusInProduct GET /v1/products/{productId}/skus List SKUs in Product
ProductsApi updateProduct PUT /v1/products/{productId} Update Product
ProductsApi updateProductsInBulk POST /v1/products/bulk/async Update Products in Bulk
ProductsApi updateProductsMetadataInBulk POST /v1/products/metadata/async Update Products' Metadata in Bulk
ProductsApi updateSku PUT /v1/products/{productId}/skus/{skuId} Update SKU
PromotionsApi addPromotionTierToCampaign POST /v1/promotions/{campaignId}/tiers Add Promotion Tier to Campaign
PromotionsApi createPromotionStack POST /v1/promotions/{campaignId}/stacks Create Promotion Stack
PromotionsApi deletePromotionStack DELETE /v1/promotions/{campaignId}/stacks/{stackId} Delete Promotion Stack
PromotionsApi deletePromotionTier DELETE /v1/promotions/tiers/{promotionTierId} Delete Promotion Tier
PromotionsApi disablePromotionTier POST /v1/promotions/tiers/{promotionTierId}/disable Disable Promotion Tier
PromotionsApi enablePromotionTier POST /v1/promotions/tiers/{promotionTierId}/enable Enable Promotion Tier
PromotionsApi getPromotionStack GET /v1/promotions/{campaignId}/stacks/{stackId} Get Promotion Stack
PromotionsApi getPromotionTier GET /v1/promotions/tiers/{promotionTierId} Get Promotion Tier
PromotionsApi listAllPromotionStacks GET /v1/promotions/stacks List Promotion Stacks
PromotionsApi listPromotionStacksInCampaign GET /v1/promotions/{campaignId}/stacks List Promotion Stacks in Campaign
PromotionsApi listPromotionTiers GET /v1/promotions/tiers List Promotion Tiers
PromotionsApi listPromotionTiersFromCampaign GET /v1/promotions/{campaignId}/tiers List Promotion Tiers from Campaign
PromotionsApi updatePromotionStack PUT /v1/promotions/{campaignId}/stacks/{stackId} Update Promotion Stack
PromotionsApi updatePromotionTier PUT /v1/promotions/tiers/{promotionTierId} Update Promotion Tier
PublicationsApi createPublication POST /v1/publications Create Publication
PublicationsApi createPublication1 GET /v1/publications/create Create Publication
PublicationsApi listPublications GET /v1/publications List Publications
QualificationsApi checkEligibility POST /v1/qualifications Check Eligibility
RedemptionsApi getRedemption GET /v1/redemptions/{redemptionId} Get Redemption
RedemptionsApi getVoucherRedemptions GET /v1/vouchers/{code}/redemption Get Voucher's Redemptions
RedemptionsApi listRedemptions GET /v1/redemptions List Redemptions
RedemptionsApi redeemStackedDiscounts POST /v1/redemptions Redeem Stackable Discounts
RedemptionsApi rollbackRedemption POST /v1/redemptions/{redemptionId}/rollback Rollback Redemption
RedemptionsApi rollbackStackedRedemptions POST /v1/redemptions/{parentRedemptionId}/rollbacks Rollback Stackable Redemptions
RewardsApi createReward POST /v1/rewards Create Reward
RewardsApi createRewardAssignment POST /v1/rewards/{rewardId}/assignments Create Reward Assignment
RewardsApi deleteReward DELETE /v1/rewards/{rewardId} Delete Reward
RewardsApi deleteRewardAssignment DELETE /v1/rewards/{rewardId}/assignments/{assignmentId} Delete Reward Assignment
RewardsApi getReward GET /v1/rewards/{rewardId} Get Reward
RewardsApi getRewardAssignment GET /v1/rewards/{rewardId}/assignments/{assignmentId} Get Reward Assignment
RewardsApi listRewardAssignments GET /v1/rewards/{rewardId}/assignments List Reward Assignments
RewardsApi listRewards GET /v1/rewards List Rewards
RewardsApi updateReward PUT /v1/rewards/{rewardId} Update Reward
RewardsApi updateRewardAssignment PUT /v1/rewards/{rewardId}/assignments/{assignmentId} Update Reward Assignment
SegmentsApi createSegment POST /v1/segments Create Segment
SegmentsApi deleteSegment DELETE /v1/segments/{segmentId} Delete Segment
SegmentsApi getSegment GET /v1/segments/{segmentId} Get Segment
ValidationRulesApi createValidationRuleAssignment POST /v1/validation-rules/{validationRuleId}/assignments Create Validation Rules Assignments
ValidationRulesApi createValidationRules POST /v1/validation-rules Create Validation Rules
ValidationRulesApi deleteValidationRuleAssignment DELETE /v1/validation-rules/{validationRuleId}/assignments/{assignmentId} Delete Validation Rule Assignment
ValidationRulesApi deleteValidationRules DELETE /v1/validation-rules/{validationRuleId} Delete Validation Rule
ValidationRulesApi getValidationRule GET /v1/validation-rules/{validationRuleId} Get Validation Rule
ValidationRulesApi listValidationRuleAssignments GET /v1/validation-rules/{validationRuleId}/assignments List Validation Rule Assignments
ValidationRulesApi listValidationRules GET /v1/validation-rules List Validation Rules
ValidationRulesApi listValidationRulesAssignments GET /v1/validation-rules-assignments List Validation Rules' Assignment(s)
ValidationRulesApi updateValidationRule PUT /v1/validation-rules/{validationRuleId} Update Validation Rule
ValidationsApi validateStackedDiscounts POST /v1/validations Validate Stackable Discounts
VouchersApi createVoucher POST /v1/vouchers/{code} Create Voucher
VouchersApi deleteVoucher DELETE /v1/vouchers/{code} Delete Voucher
VouchersApi disableVoucher POST /v1/vouchers/{code}/disable Disable Voucher
VouchersApi enableVoucher POST /v1/vouchers/{code}/enable Enable Voucher
VouchersApi exportVoucherTransactions POST /v1/vouchers/{code}/transactions/export Export Voucher Transactions
VouchersApi generateRandomCode POST /v1/vouchers Generate Random Code
VouchersApi getVoucher GET /v1/vouchers/{code} Get Voucher
VouchersApi importVouchers POST /v1/vouchers/import Import Vouchers
VouchersApi importVouchersUsingCsv POST /v1/vouchers/importCSV Import Vouchers using CSV
VouchersApi listVoucherTransactions GET /v1/vouchers/{code}/transactions List Voucher Transactions
VouchersApi listVouchers GET /v1/vouchers List Vouchers
VouchersApi releaseValidationSession DELETE /v1/vouchers/{code}/sessions/{sessionKey} Release Validation Session
VouchersApi updateVoucher PUT /v1/vouchers/{code} Update Voucher
VouchersApi updateVoucherBalance POST /v1/vouchers/{code}/balance Add or Remove Voucher Balance
VouchersApi updateVouchersInBulk POST /v1/vouchers/bulk/async Update Vouchers in Bulk
VouchersApi updateVouchersMetadataInBulk POST /v1/vouchers/metadata/async Update Vouchers' Metadata in Bulk

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

Run 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.

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: 3.0.0
  • Build package: org.openapitools.codegen.languages.PhpNextgenClientCodegen