Swipez Docs
Search…
Franchise
Learn more about franchise APIs and their usage.

Guidelines

Below are some of the points you must be aware of while calling Payouts APIs:
  • All API requests and responses are in JSON format.
  • POST requests should include ContentType: application/json
  • All API response have status, message, and data.
  • Swipez uses API keys to allow access to the API. Once you have signed up at our merchant site, you will be able to see your AccessKey and SecretKey.

Quick Reference

URL
HTTP Verb
Functionality
POST
To get auth token.
POST
To save franchise details.
POST
To update franchise details.
POST
To delete franchise.

Authentication

Calling the Authentication APIs allows you to get and verify bearer tokens returned by Swipez. Swipez require these token for all further communication.
  • Swipez libraries automatically call the Authorize API and internally store the token.
  • Do not store the token in an insecure manner. Regenerating a new token does not invalidate the already generated token. Token generated from one IP address cannot be used from a different IP address.
  • Token generated is valid for 60 Min . Please ensure that you get a new token by calling the authorize API once the token has expired.

Rate limiting

The API is rate limited per user. You will receive a 429 HTTP status code if you exceed the rate limit. The rate limit is 30 requests per minute per user and is subject to change.
post
/api/token
Get token

Sample code

CURL
PHP
1
curl --location --request POST '<BASE URL>/api/token' \
2
--form 'access_key_id="<GET ACCESS KEY ID FROM YOUR ACCOUNT>"' \
3
--form 'secret_access_key="<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>"'
4
5
Copied!
1
$curl = curl_init();
2
3
curl_setopt_array($curl, array(
4
CURLOPT_URL => '<BASE URL>/api/token',
5
CURLOPT_RETURNTRANSFER => true,
6
CURLOPT_ENCODING => '',
7
CURLOPT_MAXREDIRS => 10,
8
CURLOPT_TIMEOUT => 0,
9
CURLOPT_FOLLOWLOCATION => true,
10
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
11
CURLOPT_CUSTOMREQUEST => 'POST',
12
CURLOPT_POSTFIELDS => array('access_key_id' => '<GET ACCESS KEY ID FROM YOUR ACCOUNT>','secret_access_key' => '<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>'),
13
));
14
15
$response = curl_exec($curl);
16
17
curl_close($curl);
18
echo $response;
19
Copied!
post
/api/v1/franchise/save
Save franchise

Sample code

CURL
PHP
1
curl --location --request POST '<BASE URL>/api/v1/franchise/save' \
2
--header 'Authorization: Bearer <TOKEN>' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"franchise_code": "5",
6
"franchise_name": "john Ppp",
7
"contact_person_name":"Paresh",
8
"email_id": "[email protected]",
9
"mobile": "9999999999",
10
"pan_number": "",
11
"aadhar_number": "",
12
"gst_number": "",
13
"address": "404, Ferry bell,Lodha medows",
14
"city": "Pune",
15
"state": "Maharashtra",
16
"zipcode": "411016",
17
"enable_online_settlement": "1",
18
"commission_type": "Percentage",
19
"commission": "50",
20
"settlement_type":"Auto",
21
"bank_holder_name": "Paresh",
22
"account_number": "00111122236",
23
"bank_name": "SBI",
24
"account_type": "Saving",
25
"ifsc": "HDFC0000001",
26
"enable_franchise_login":"1",
27
"login_email":"[email protected]",
28
"password":"password1",
29
"role_name":"Role 1"
30
}
31
'
Copied!
1
2
$curl = curl_init();
3
4
curl_setopt_array($curl, array(
5
CURLOPT_URL => '<BASE URL>/api/v1/franchise/save',
6
CURLOPT_RETURNTRANSFER => true,
7
CURLOPT_ENCODING => '',
8
CURLOPT_MAXREDIRS => 10,
9
CURLOPT_TIMEOUT => 0,
10
CURLOPT_FOLLOWLOCATION => true,
11
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
12
CURLOPT_CUSTOMREQUEST => 'POST',
13
CURLOPT_POSTFIELDS =>'{
14
"franchise_code": "5",
15
"franchise_name": "john Ppp",
16
"contact_person_name":"Paresh",
17
"email_id": "[email protected]",
18
"mobile": "9999999999",
19
"pan_number": "",
20
"aadhar_number": "",
21
"gst_number": "",
22
"address": "404, Ferry bell,Lodha medows",
23
"city": "Pune",
24
"state": "Maharashtra",
25
"zipcode": "411016",
26
"enable_online_settlement": "1",
27
"commission_type": "Percentage",
28
"commission": "50",
29
"settlement_type":"Auto",
30
"bank_holder_name": "Paresh",
31
"account_number": "00111122236",
32
"bank_name": "SBI",
33
"account_type": "Saving",
34
"ifsc": "HDFC0000001",
35
"enable_franchise_login":"1",
36
"login_email":"[email protected]",
37
"password":"password1",
38
"role_name":"Role 1"
39
}
40
',
41
CURLOPT_HTTPHEADER => array(
42
'Authorization: Bearer <TOKEN>',
43
'Content-Type: application/json'
44
),
45
));
46
47
$response = curl_exec($curl);
48
49
curl_close($curl);
50
echo $response;
Copied!
post
/api/v1/franchise/update
Update franchise

Sample code

CURL
PHP
1
curl --location --request POST '<BASE URL>/api/v1/franchise/update' \
2
--header 'Authorization: Bearer <TOKEN>' \
3
--header 'Content-Type: application/json' \
4
--data-raw '{
5
"franchise_id": "5",
6
"franchise_name": "john Ppp",
7
"contact_person_name":"Paresh",
8
"email_id": "[email protected]",
9
"mobile": "9999999999",
10
"pan_number": "",
11
"aadhar_number": "",
12
"gst_number": "",
13
"address": "404, Ferry bell,Lodha medows",
14
"city": "Pune",
15
"state": "Maharashtra",
16
"zipcode": "411016"
17
}
18
'
Copied!
1
2
$curl = curl_init();
3
4
curl_setopt_array($curl, array(
5
CURLOPT_URL => '<BASE URL>/api/v1/franchise/update',
6
CURLOPT_RETURNTRANSFER => true,
7
CURLOPT_ENCODING => '',
8
CURLOPT_MAXREDIRS => 10,
9
CURLOPT_TIMEOUT => 0,
10
CURLOPT_FOLLOWLOCATION => true,
11
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
12
CURLOPT_CUSTOMREQUEST => 'POST',
13
CURLOPT_POSTFIELDS =>'{
14
"franchise_id": "5",
15
"franchise_name": "john Ppp",
16
"contact_person_name":"Paresh",
17
"email_id": "[email protected]",
18
"mobile": "9999999999",
19
"pan_number": "",
20
"aadhar_number": "",
21
"gst_number": "",
22
"address": "404, Ferry bell,Lodha medows",
23
"city": "Pune",
24
"state": "Maharashtra",
25
"zipcode": "411016"
26
}
27
',
28
CURLOPT_HTTPHEADER => array(
29
'Authorization: Bearer <TOKEN>',
30
'Content-Type: application/json'
31
),
32
));
33
34
$response = curl_exec($curl);
35
36
curl_close($curl);
37
echo $response;
Copied!
post
/api/v1/franchise/delete
Delete franchise

Sample code

CURL
PHP
1
curl --location --request POST '<BASE URL>/api/v1/franchise/delete' \
2
--header 'Authorization: Bearer <TOKEN>' \
3
--header 'Content-Type: application/json' \
4
--form 'franchise_id="39"'
Copied!
1
$curl = curl_init();
2
3
curl_setopt_array($curl, array(
4
CURLOPT_URL => '<BASE URL>/api/v1/franchise/update',
5
CURLOPT_RETURNTRANSFER => true,
6
CURLOPT_ENCODING => '',
7
CURLOPT_MAXREDIRS => 10,
8
CURLOPT_TIMEOUT => 0,
9
CURLOPT_FOLLOWLOCATION => true,
10
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
11
CURLOPT_CUSTOMREQUEST => 'POST',
12
CURLOPT_POSTFIELDS => array('franchise_id' => '1'),
13
CURLOPT_HTTPHEADER => array(
14
'Authorization: Bearer <TOKEN>',
15
'Content-Type: application/json'
16
),
17
));
18
19
$response = curl_exec($curl);
20
21
curl_close($curl);
22
echo $response;
Copied!
Last modified 6mo ago