Introduction
messages.This section describes the FlexyPay messages.payment gateway API.
FlexyPay messages.API is easy to implement in your business software. Our API is well formatted URLs, accepts cURL requests, returns JSON responses.
messages.You can use the API in test mode, which does not affect your live data. The API key is use to authenticate the request and determines the request is valid payment or not. For test mode just use the sandbox URL and In case of live mode use the live URL from section Intiate Payment .
messages.Supported Currencies
This section describes the currencies supported by FlexyPay
FlexyPay messages.allows to make transaction with below currencies. Any new currency may update in future.
Currency Name | Currency Symbol | Currency Code |
---|---|---|
Central African Franc | xaf | XAF |
messages.Get The Api Key
messages.This section describes how you can get your api key.
messages.Login to your FlexyPay messages.merchant account. messages.If you don't have any ? Click Here
messages.Next step is to find the messages.Api Key messages.menu in your dashboard sidebar. Click the menu.
messages.The api keys can be found there which is messages.Public key and Secret key. messages.Use these keys to initiate the API request. Every time you can generate new API key by clicking messages.Generate Api Key messages.button. Remember do not share these keys with anyone.
Intiate Payment
messages.This section describes the process of initaiing the payment.
messages.To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.
messages.Live End Point: https://flexy-pay.com/payment/initiate
messages.Test End Point: https://flexy-pay.com/sandbox/payment/initiate
messages.Test Mode Mail: test_mode@mail.com
messages.Test Mode Verification Code: 222666
messages.Request Method: POST
messages.Request to the end point with the following parameters below.
messages.Param Name | messages.Param Type | Description |
---|---|---|
public_key | string (50) | Required messages.Your Public API key |
identifier | string (20) | Required messages.Identifier is basically for identify payment at your end |
currency | string (4) | Required messages.Currency Code, Must be in Upper Case. e.g. USD,EUR |
amount | decimal | Required messages.Payment amount. |
details | string (100) | Required messages.Details of your payment or transaction. |
ipn_url | string | Required messages.The url of instant payment notification. |
success_url | string | Required messages.Payment success redirect url. |
cancel_url | string | Required messages.Payment cancel redirect url. |
site_logo | string/url | Required messages.Your business site logo. |
checkout_theme | string | Optional messages.Checkout form theme dark/light. Default theme is light |
customer_name | string (30) | Required messages.Customer name. |
customer_email | string (30) | Required messages.Customer valid email. |
<?php
$parameters = [
'identifier' => 'DFU80XZIKS',
'currency' => 'USD',
'amount' => 100.00,
'details' => 'Purchase T-shirt',
'ipn_url' => 'http://example.com/ipn_url.php',
'cancel_url' => 'http://example.com/cancel_url.php',
'success_url' => 'http://example.com/success_url.php',
'public_key' => 'your_public_key',
'site_logo' => 'https://flexy-pay.com/assets/images/logoIcon/logo.png',
'checkout_theme' => 'dark',
'customer_name' => 'John Doe',
'customer_email' => 'john@mail.com',
];
//live end point
$url = "https://flexy-pay.com/payment/initiate";
//test end point
$url = "https://flexy-pay.com/sandbox/payment/initiate";
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
//$result contains the response back.
?>
//Error Response.
{
"error": "true",
"message": "Invalid api key"
}
//Success Response.
{
"success": "ok",
"message": "Payment Initiated. Redirect to url.",
"url":"http://example.com/initiate/payment/checkout?payment_id=eJSAASDxdrt4DASDASVNASJA7893232432cvmdsamnvASF"
}
messages.Validate The Payment and IPN
messages.This section describes the process to get your instant payment notification.
messages.To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.
messages.End Point: messages.Your business application ipn url.
messages.Request Method: POST
messages.You will get following parameters below.
messages.Param Name | Description |
---|---|
status | messages.Payment success status. |
identifier | messages.Identifier is basically for identify payment at your end. |
signature | messages.A hash signature to verify your payment at your end. |
data | messages.Data contains some basic information with charges, amount, currency, payment transaction id etc. |
<?php
//Receive the response parameter
$status = $_POST['status'];
$signature = $_POST['signature'];
$identifier = $_POST['identifier'];
$data = $_POST['data'];
// Generate your signature
$customKey = $data['amount'].$identifier;
$secret = 'YOUR_SECRET_KEY';
$mySignature = strtoupper(hash_hmac('sha256', $customKey , $secret));
$myIdentifier = 'YOUR_GIVEN_IDENTIFIER';
if($status == "success" && $signature == $mySignature && $identifier == $myIdentifier){
//your operation logic
}
?>