Prepaid Coupons(Epin)

Manage Coupons

Active Coupons

get
https://<domain>/<api prefix>/<version>/user/get/active-epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/user/get/active-epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/get/active-epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Transfer Coupon

post
https://<domain>/<api prefix>/<version>/user/transfer/epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/user/transfer/epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'user': '<username>',
'epin': '<coupon id>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/transfer/epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('user' => '<username>','epin' => '<coupon id>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
FIeld
Description
400
Validation Error
user
User is not found.
Field may not be blank.
Self transfer not allowed.
User already has the maximum number of active coupons.
400
Validation Error
epin
Coupon is not found.
Coupon is not transferable.
Invalid coupon.

Share Coupon

post
https://<domain>/<api prefix>/<version>/user/share/epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/user/share/epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'email': '<user_mail>',
'epin': '<coupon_id>',
'share_amount': '<amount>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/share/epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('email' => '<user_mail>','epin' => '<coupon_id>','share_amount' => '<share_amount>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
FIeld
Description
400
Validation Error
email
This field is required.
This field may not be blank.
Enter a valid email address.
400
Validation Error
epin
This field is required.
This field may not be blank.
Only numeric characters are allowed.
Coupon is not found.
Coupon is not transferable.
400
Validation Error
share_amount
This field is required.
This field may not be blank.
Only numeric characters are allowed.
Insufficient Balance.

Delete Coupon

delete
https://<domain>/<api prefix>/<version>/user/delete/epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'DELETE',
'url': 'https://<domain>/<api prefix>/<version>/user/delete/epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
'Cookie': 'store_user=admin_store; sessionid=2ysk6htgc4b3w2f87zvw9cn4v5rxqkws'
},
formData: {}
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/delete/epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
FIeld
Description
400
Validation Error
epin
This field is required.
This field may not be blank.
Only numeric characters are allowed.
Coupon is not found.

Generate Coupon

Get Wallet List

get
https://<domain>/<api prefix>/<version>/user/generate/epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/user/generate/epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/generate/epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
Description
401
Request Failed
Coupon facility is disabled, Please contact your administrator.

Create Coupon

post
https://<domain>/<api prefix>/<version>/user/generate/epin/

Sample Code

Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/user/generate/epin/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {
'wallet_type': '<wallet_key>',
'epin_amount': '<amount>',
'number_of_pins': '<number_of_coupon>',
'form_key': '<form_key>',
'token_checksum_field': '<token_checksum>',
'token_field': '<token>',
'transferable': '<True or False>',
'reusable': '<True or False>'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/generate/epin/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('wallet_type' => '<wallet_key>','epin_amount' => '<amount>','number_of_pins' => '<number of coupon>','form_key' => '<form key>','token_checksum_field' => '<token_cheksum>','token_field' => '<token>','transferable' => '<True or False>','reusable' => '<True or False>'),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Error Responses

Status Code
Error Type
FIeld
Description
400
Validation Error
wallet_type
This field is required.
This field may not be blank.
You don't have sufficient balance to continue with this operation.
400
Validation Error
epin_amount
Invalid or empty Amount.
This field is required.
This field may not be blank.
Please enter an amount between <min> and <max>.
Only integers are allowed.
Ensure this field has no more than 7 characters.
400
Validation Error
number_of_pins
This field is required.
This field may not be blank.
This operation exceeds the maximum number of active Coupons.
Invalid number of Coupon.
Only numeric characters are allowed.
400
Validation Error
transferable
This field is required.
This field may not be blank.
Select True or False
400
Validation Error
reusable
This field is required.
This field may not be blank.
Select True or False
400
Validation Error
token_checksum_field
This field is required.
This field may not be blank.
400
Validation Error
token_field
This field is required.
This field may not be blank.
Token is not matching.
400
Validation Error
form_key
You have another form running, Please reload.
401
Request Failed
Coupon facility is disabled, Please contact your administrator.

Coupon History

get
https://<domain>/<api prefix>/<version>/user/epin/history/

Sample Code

Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/user/epin/history/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/user/epin/history/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_POSTFIELDS => array(),
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;