Create Service Provider
This API is used to add/ update the details of each Service Provider associated with the seller or marketplace operator. Below are the fields that are to be sent via API using POST
Method to the Url:
For Staging: http://test-api.atarapay.com/api/serviceprovider/create
for live: https://api.atarapay.com/api/serviceprovider/create
Field name | Required | Description |
---|---|---|
authtoken | Yes | This is calculated using the steps mentioned here Calculation of Auth Token |
type | Yes | 1 or 2, where 1 means NGN bank account and 2 means USD bank account |
bank_code | Yes | This is a 3-digit numeric code to identify the bank, required if type = 1 (NGN bank account) |
nip_bank_code | Yes | This is a 6-digit numeric code to identify the bank, required if type = 1 (NGN bank account) |
bank_account_number | Yes | This is the NGN bank account number of the Service Provider where the funds would be transferred to, required if type = 1 (NGN bank account) |
bank_account_name | Yes | This is the bank account name of the Service Provider, required if type = 1 (NGN bank account) |
bank_name | Yes | This is the name of the bank used by the Service Provider, required if type = 1 (NGN bank account) |
account_id | Yes | This is the Wise account id of the Service Provider where the funds would be transferred to, required if type = 2 (USD bank account) |
Yes | Email address of the Service Provider | |
phone | Yes | Phone number of the Service Provider |
firstname | Yes | First name of the Service Provider |
lastname | Yes | Last name of the Service Provider |
Successfull Response
{
"status": "success",
"message": "Service Provider Updated successfully",
"data": {
"id": 4,
"type": 1,
"firstname": "Emeka",
"lastname": "Adeniyi",
"phone": "+2348082094382",
"email": "emeka.adeniyi@atarapay.com",
"bank_code": "221",
"nip_bank_code": "000000",
"bank_name": "Axis",
"bank_account_name": "Emeka Adeniyi",
"bank_account_number": "1234567890",
"recipient_code": null,
"account_id": null,
"account_type": null,
"created_at": "2020-02-20 16:54:01",
"updated_at": "2020-02-24 21:20:59"
}
}
Failure Response
{
"status": "error",
"message": "The authtoken field is required."
}
Sample codes
C#
var client = new RestClient("http://test-api.atarapay.com/api/serviceprovider/create");
var request = new RestRequest(Method.POST);;
request.AddHeader("cache-control", "no-cache");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("application/x-www-form-urlencoded", "type=__Service_Provider_type__&email=__Service_Provider_Email__&phone=__Service_Provider_Phone__&firstname=__Service_Provider_Firstname__&lastname=__Service_Provider_Lastname__&authtoken=__Auth_token_calculated__&bank_code=__Service_Provider_Bank_Code__&nip_bank_code=__Service_Provider_NIP_Bank_Code__&bank_account_number=__Service_Provider_Bank_Account_Number__&bank_account_name=__Service_Provider_Bank_Account_Name__&bank_name=__Service_Provider_Bank_Name__", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
PHP
$request = new HttpRequest();
$request->setUrl('http://test-api.atarapay.com/api/serviceprovider/create');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'cache-control' => 'no-cache',
'content-type' => 'application/x-www-form-urlencoded'
));
$request->setContentType('application/x-www-form-urlencoded');
$request->setPostFields(array(
'type' => '__Service_Provider_type__',
'email' => '__Service_Provider_Email__',
'phone' => '__Service_Provider_Phone__',
'firstname' => '__Service_Provider_Firstname__',
'lastname' => '__Service_Provider_Lastname__',
'authtoken' => '__Auth_token_calculated__',
'bank_code' => '__Service_Provider_Bank_Code__',
'nip_bank_code' => '__Service_Provider_NIP_Bank_Code__',
'bank_account_number' => '__Service_Provider_Bank_Account_Number__',
'bank_account_name' => '__Service_Provider_Bank_Account_Name__',
'bank_name' => '__Service_Provider_Bank_Name__'
));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
Node Js
var unirest = require("unirest");
var req = unirest("POST", "http://test-api.atarapay.com/api/serviceprovider/create");
req.headers({
"cache-control": "no-cache",
"content-type": "application/x-www-form-urlencoded"
});
req.form({
"type": "__Service_Provider_type__",
"email": "__Service_Provider_Email__",
"phone": "__Service_Provider_Phone__",
"firstname": "__Service_Provider_Firstname__",
"lastname": "__Service_Provider_Lastname__",
"authtoken": "__Auth_token_calculated__",
"bank_code": "__Service_Provider_Bank_Code__",
"nip_bank_code": "__Service_Provider_NIP_Bank_Code__",
"bank_account_number": "__Service_Provider_Bank_Account_Number__",
"bank_account_name": "__Service_Provider_Bank_Account_Name__",
"bank_name": "__Service_Provider_Bank_Name__"
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});