Comment on page
Franchise
Learn more about franchise APIs and their usage.
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.
URL | HTTP Verb | Functionality |
POST | To get auth token. | |
POST | To save franchise details. | |
POST | To update franchise details. | |
POST | To delete franchise. |
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.
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
CURL
PHP
curl --location --request POST '<BASE URL>/api/token' \
--form 'access_key_id="<GET ACCESS KEY ID FROM YOUR ACCOUNT>"' \
--form 'secret_access_key="<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/token',
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('access_key_id' => '<GET ACCESS KEY ID FROM YOUR ACCOUNT>','secret_access_key' => '<GET SECRET ACCESS KEY FROM YOUR ACCOUNT>'),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/franchise/save
Save franchise
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/franchise/save' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"franchise_code": "5",
"franchise_name": "john Ppp",
"contact_person_name":"Paresh",
"email_id": "[email protected]",
"mobile": "9999999999",
"pan_number": "",
"aadhar_number": "",
"gst_number": "",
"address": "404, Ferry bell,Lodha medows",
"city": "Pune",
"state": "Maharashtra",
"zipcode": "411016",
"enable_online_settlement": "1",
"commission_type": "Percentage",
"commission": "50",
"settlement_type":"Auto",
"bank_holder_name": "Paresh",
"account_number": "00111122236",
"bank_name": "SBI",
"account_type": "Saving",
"ifsc": "HDFC0000001",
"enable_franchise_login":"1",
"login_email":"[email protected]",
"password":"password1",
"role_name":"Role 1"
}
'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/franchise/save',
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 =>'{
"franchise_code": "5",
"franchise_name": "john Ppp",
"contact_person_name":"Paresh",
"email_id": "[email protected]",
"mobile": "9999999999",
"pan_number": "",
"aadhar_number": "",
"gst_number": "",
"address": "404, Ferry bell,Lodha medows",
"city": "Pune",
"state": "Maharashtra",
"zipcode": "411016",
"enable_online_settlement": "1",
"commission_type": "Percentage",
"commission": "50",
"settlement_type":"Auto",
"bank_holder_name": "Paresh",
"account_number": "00111122236",
"bank_name": "SBI",
"account_type": "Saving",
"ifsc": "HDFC0000001",
"enable_franchise_login":"1",
"login_email":"[email protected]",
"password":"password1",
"role_name":"Role 1"
}
',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/franchise/update
Update franchise
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/franchise/update' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--data-raw '{
"franchise_id": "5",
"franchise_name": "john Ppp",
"contact_person_name":"Paresh",
"email_id": "[email protected]",
"mobile": "9999999999",
"pan_number": "",
"aadhar_number": "",
"gst_number": "",
"address": "404, Ferry bell,Lodha medows",
"city": "Pune",
"state": "Maharashtra",
"zipcode": "411016"
}
'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/franchise/update',
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 =>'{
"franchise_id": "5",
"franchise_name": "john Ppp",
"contact_person_name":"Paresh",
"email_id": "[email protected]",
"mobile": "9999999999",
"pan_number": "",
"aadhar_number": "",
"gst_number": "",
"address": "404, Ferry bell,Lodha medows",
"city": "Pune",
"state": "Maharashtra",
"zipcode": "411016"
}
',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
post
/api/v1/franchise/delete
Delete franchise
CURL
PHP
curl --location --request POST '<BASE URL>/api/v1/franchise/delete' \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--form 'franchise_id="39"'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '<BASE URL>/api/v1/franchise/update',
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('franchise_id' => '1'),
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer <TOKEN>',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Last modified 2yr ago