Overview
CSV Feed
PHP SDK
API Integration
API For Partners
Discounts
This method can be applied on your server-side, in order to get all the discount codes which have been allocated to customers (via email triggers, sms triggers or newsletter).
Method: GET
URL: https://api.retargeting.app/v1/discount-codes
Function parameters
Field | Type | Required | Description |
---|---|---|---|
k | number or text | True | The REST API Key can be found into your account Settings -> Integration -> REST API Key, second field. |
date | text | True | Date in yyyy-mm-dd format |
Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.
If your account is INACTIVE or CLOSED the API call will not work.
The API call will respond with JSON format.
Example
<?php require_once "vendor/autoload.php"; $apiURL = "https://api.retargeting.app/v1/"; $apiKey = "MyAPI_REST_Key"; $date = "2021-10-04"; $client = new GuzzleHttp\Client(); $discountsData = [ "k" => $apiKey, "date" => $date ]; $statusRequest = $client->request("GET", $apiURL . "discount-codes", ["query" => $discountsData]);
If the API call succeeds, then the response will be as seen below:
{ status: "success", data: [ { "email": "customeremail@example.com", "code": "multiuse_code", "used": null, "type": "multiuse", // For multi use codes "date": "2021-09-14 08:50:52", "expire_date": "", "discount_type": { "token": "multiuse_percentage_10", "type": "multiuse_percentage", "value": "10", "name": "multiuse_code" } }, { "email": "customeremail@example.com", "code": "unique_code", "used": true, "type": "unique", // For unique discount codes "date": "2021-09-14 08:50:52", "expire_date": "", "discount_type": { "token": "unique_percentage_10", "type": "unique_percentage", "value": "10", "name": "unique_code" } } }
If the API call fails, the response will be as seen below:
{ status: "Incorrect key" // if invalid API key is used }
OR
{ status: "Incorrect date" // if date isn't provided }