API Documentation
Here's the documentation for our API:
GET /api/resource
Get a resource by providing an company_email parameter.
Headers:
Header |
Value |
Description |
Authentication-key |
YOUR_AUTHENTICATION_KEY |
authentication key. |
Content-Type |
application/json |
Specifies the content type of the request body. |
Custom-Header |
Custom-Value |
Custom header for the request. |
Parameters:
Parameter |
Type |
Description |
company_email |
String |
The company_email of the resource to retrieve. |
Request:
Using cURL Request
$headers = [
'Authentication-key: Your authentication key',
'Content-Type: application/json',
'Custom-Header: Custom-Value',
];
$params = [
'company_email' => 'company_email',
];
$url = 'https://onepostbank.com/api/get-api-token?' . http_build_query($params);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
Response:
HTTP/ 200 OK
Content-Type: application/json
{
"remark": "Authenticated",
"status": "success",
"message": {
"success": "Authenticated"
},
"data": [
"token",
"received Token"
]
}
HTTP/401 Unauthorized
Content-Type: application/json
{
"remark": "Authentication error.",
"status": "error",
"message": "Authentication error"
}
POST /api/resource
Create a resource by providing data in the request body.
Headers:
Header |
Value |
Description |
Authorization |
'Bearer Received_Token_From_GET_request" |
token |
Authentication-key |
YOUR_AUTHENTICATION_KEY |
Authentication key. |
Content-Type |
application/json |
Specifies the content type of the request body. |
Custom-Header |
Custom-Value |
Custom header for the request. |
Parameters:
Parameter |
Type |
Description |
public_key |
String |
Your Public Key |
secret_key |
String |
Your Secret Key |
currency_code |
String |
Your Default Currency Code |
debit_card_number |
String |
User Debit Card number |
card_expiry_month |
String |
Debit Card expiration month |
card_expiry_year |
String |
Debit Card expiration year |
debit_card_cvv |
String |
User Debit Card code verification value |
total_amount |
Number |
Total Amount |
user_name |
String |
Name of user |
user_email |
String |
User Email |
Request:
Using cURL Request
use Illuminate\Support\Facades\Http;
use GuzzleHttp\Client;
$data = [
"public_key" => "company_public_key",
"secret_key" => "company_secret_key",
"debit_card_number" => "123456789098765234",
"debit_card_cvv" => "123",
"total_amount" => "amount",
"user_name" => "user name",
"user_email" => "user email"
];
$headers = [
'Authorization: Bearer ' . $token,
'Authentication-key: your authenctication key',
'Content-Type: application/json',
'Custom-Header: Custom-Value'
];
$ch = curl_init('https://onepostbank.com/api/make_payment');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$response = curl_exec($ch);
curl_close($ch);
$responseBody = json_decode($response, true);
Using guzzle HTTP Request
use Illuminate\Support\Facades\Http;
use GuzzleHttp\Client;
$data = [
"public_key" => "company_public_key",
"secret_key" => "company_secret_key",
"debit_card_number" => "123456789098765234",
"debit_card_cvv" => "123",
"total_amount" => "amount",
"user_name" => "user name",
"user_email" => "user email"
];
$headers = [
'Authorization' => 'Bearer ' . $token,
'Authentication-key' => 'your authentication key',
'Content-Type' => 'application/json',
'Custom-Header' => 'Custom-Value',
];
$client = new Client(['verify' => false]);
$response = $client->post('https://onepostbank.com/api/make_payment', [
'headers' => $headers,
'json' => $data,
]);
$responseBody = json_decode($response->getBody(), true);
Response:
HTTP/ 200 OK
Content-Type: application/json
{
"remark": "Payment Complete",
"status": "success",
"message": {
"success": "Your payment has been successfully processed."
},
"data": {
"owner_account_number": "account_number",
"owner_trx_number": "trx_number",
"payeer_trx_number": "trx_number",
"owner_trx_details": "Payment received from user 'user name' have email address 'user email'. via debit card ************12345",
"total_amount": "amount",
"user_name": "user name",
"user_email": "user email"
}
}
HTTP 400 Bad Request
Content-Type: application/json
{
"remark": "Validation error.",
"status": "error",
"message":"error message"
}