Quick Samples

Below is a list of guides to get up and running very quickly in a few common languages.

dotNet

  1. Download the encode.client package from Techsys Package Server
  2. Create a campaign on the encode platform.
  3. Add an Integration.
  4. Copy the Integration Url, Username and Password from the integrations section, which you will use to configure the client.
1
2
3
4
5
6
7
8
var config = new EncodeClientConfig {
    Url = "https://encode-api.techsys.co.za/redeem/xxxxxxxxxxxxxxxxxxxxxxxxxxx",
    Username = "USERNAME",
    Password = "PASSWORD"
};

var client = EncodeClientFactory.Create(config);
var result = client.Redeem("27831234567", "XXAACCEE");

All components are designed to be injected.

The Client config should be injected as a Singleton and the Client as a Scoped or Transient.

Php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
$username = 'USERNAME';
$password = 'PASSWORD';
$url = 'https://encode-api.techsys.co.za/redeem/xxxxxxxxxxxxxxxxxxxxxxxxxxx'
$headers = array(
    'Content-Type:application/json',
    'Authorization: Basic '. base64_encode($username . ":" . $password)
);
$data = array("code" => "XXAACCEE", "redeemer" => "27831234567");
$payload = json_encode($data);

$process = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $payload);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
curl_close($process);

Node