Introduction
Fatora gateway provides robust features for processing online payments, it processes payments securely and conveniently in real time.
- Easy integration.
- A flexibly adaptable solution for meeting your needs.
- High level of data transfer security.
Start With Fatora Gateway
If you are new to Fatora gateway, you have to subscribe at the beginning.
To subscribe, you have to send the following information to Maktapp support.
- Commercial registration.
- A scan copy of a personal identification.
- Application name.
- Application type (website or mobile application).
- API key of your application in Firebase Cloud Messaging (in case mobile application), Fatora gateway will send push notifications after the end of processing payments.
- URL of success and failure page of your application to redirect clients to these URL after the end of proccessing payments.
After subscription, Maktapp support will send you an APIKEY, which is provide to merchant, and later you will use it in calling Fatora API.
Steps Of Payment
An online payment goes through the following steps:
1. Initialize payment:
- a client clicks on a pay or subscribe button in the merchant application.
- the merchant application sends a request to Fatora gateway to get the URL of checkout page.
- the merchant application redirects the client to this URL.
2. Process payment:
- the client enters his card data and clicks pay button in checkout page.
- Fatora gateway processes the payment and redirects the client to success page of the merchant application or the failure page according to payment status (SUCCESS or FAILURE).
3. Verify request source:
- the merchant application receives a request to success or failure page.
- the merchant application should verify source of request (from Fatora gateway or from hacker) by sending request to Fatora gateway to check payment status.
Tokenization
Fatora gateway support tokenization to save your clients from having to re-enter card details in checkout page in each time they pay from your application. This will improve clients' user experience when making payments through your application.
Examples:
1.Autosave payment
When a client makes his first purchase in your application, after processing payment and in success case Fatora gateway will send token (which is Card Token) to your application, your application should save it.
Therefore, when the client returns to your application to make another purchase, your application should send this token to Fatora gateway to use it in deducting amount directly from the client account without redirecting him to the checkout page.
2.Recurring payment or subscription
When a client subscribes in a service in your application, after processing subscription and in success case, Fatora gateway will send token to your application.
Therefore, in each time a payment is due, your application will send this token to Fatora gateway to use it in deducting amount from the client account automatically.
Payment
Onetime Payment
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/AddTransaction';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'FcmToken' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
'currencyCode' => "XXX",
'orderId' => "XXXXXXX",
'amount' => XXXX,
'customerEmail' => "XXXX",
'customerName' => "XXXX",
'customerPhone' => "XXXX",
'customerCountry' => "XXXX",
'lang' => "ar",
'note' => "XXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/AddTransaction ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"FcmToken", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},
{"currencyCode", "XXX"},
{"orderId", "XXXXXXX"},
{"amount", XXX},
{"customerEmail", "XXXX"},
{"customerName", "XXXX"},
{"customerPhone", "XXXX"},
{"customerCountry", "XXXX"},
{"lang", "ar"},
{"note", "testpayment"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken ":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode": "XXX",
"orderId": "XXXXXXX",
"amount": XXXX,
"customerEmail": "XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry": "XXXX",
"lang": "ar",
"note": ""
};
$.ajax({
url: 'https://maktapp.credit/v3/AddTransaction',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/AddTransaction
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode":"XXX",
"orderId":"XXXXXXX",
"amount":XXXX,
"customerEmail":"XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry":"XXX",
"lang":"ar",
"note":"XXXX"
}'
The above request will returns JSON structured if all parameters are valid like this:
{
"result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX"
}
The above request will returns JSON structured if one parameter is null or not valid like this:
{
"result": x
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows the merchant application to initialize a onetime payment and get the URL of checkout page.
HTTP Request
POST https://maktapp.credit/v3/AddTransaction
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | String value. API token. |
FcmToken | Optional | String value. Mobile FCM Token. |
currencyCode | Optional | String value. currency code of your country as an ISO 4217 alpha code. The default code is QAR. If you want to support more than one currency, contact with Maktapp support. |
orderId | Required | String value. A unique identifier for each payment in your application. |
amount | Required | Decimal value. Payment amount that will be deducted from the client account. |
customerEmail | Required | String value, it should have valid email address format. Client email address. |
customerName | Optional | String value. Client Name. |
customerPhone | Optional | String value. Client phone, including country code. |
customerCountry | Optional | String value. Client country. |
lang | Optional | String value, it should have one of these value{"en","ar"}. Language of checkout page. Default value is "ar". |
note | Optional | String value. Notes about the payment. |
If all the required parameters are valid, Fatora gateway will return URL of checkout page in a JSON format, like following:
Response JSON
{ "result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX" }
If the value of one parameter are not valid, Fatora gateway will return a response in JSON format containing error code, like following:
Response JSON
{ "result": x } [-1, -2, -3, -6, -8, -10, -20, -21 ]
After getting the URL of checkout page, the merchant application should redirect his client to this URL, when the client enters his card data in checkout page and clicks on pay button, Fatora gateway will process the payment and redirects the client to success or failure page of the merchant application.
In success case, Fatora gateway will redirect client to merchant success page, and will request the merchant success page with the following parameters:
Redirect to success page
Merchant_SUCCESS_URL?transId=XXX&orderId=XXX&mode=XXX
In failure case, Fatora gateway will redirect client to merchant failure page, and will request merchant failure page with the following parameters:
Redirect to failure page
Merchant_FAILURE_URL?transId=XXX&orderId=XXX&Failerdescription=XXX
Request Parameters
Parameter | Description |
---|---|
transId | Transaction id of payment created by bank. |
orderId | OrderId of payment(sent by your application at requesting Initialize Payment API). |
mode | It has one of the following values {"test", "live"} according to merchant mode. |
Failerdescription | It describes why the payment is failed. |
Recurring Payment
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/AddTransaction';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'FcmToken' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
'currencyCode' => "XXX",
'orderId' => "XXXXXXX",
'amount' => XXXX,
'customerEmail' => "XXXX",
'customerName' => "XXXX",
'customerPhone' => "XXXX",
'customerCountry' => "XXXX",
'lang' => "ar",
'isRecurring' => true,
'note' => "XXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/AddTransaction ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"FcmToken", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},
{"currencyCode", "XXX"},
{"orderId", "XXXXXXX"},
{"amount", XXX},
{"customerEmail", "XXXX"},
{"customerName", "XXXX"},
{"customerPhone", "XXXX"},
{"customerCountry", "XXXX"},
{"lang", "ar"},
{"isRecurring", true},
{"note", "testpayment"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken ":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode": "XXX",
"orderId": "XXXXXXX",
"amount": XXXX,
"customerEmail": "XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry": "XXXX",
"lang": "ar",
"isRecurring":true,
"note": ""
};
$.ajax({
url: 'https://maktapp.credit/v3/AddTransaction',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/AddTransaction
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode":"XXX",
"orderId":"XXXXXXX",
"amount":XXXX,
"customerEmail":"XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry":"XXX",
"lang":"ar",
"isRecurring":true,
"note":"XXXX"
}'
The above request will returns JSON structured if all parameters are valid:
{
"result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX"
}
The above request will returns JSON structured if one parameter is null or not valid:
{
"result": x
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows the merchant application to initialize a recurring payment and get the URL of checkout page.
HTTP Request
POST https://maktapp.credit/v3/AddTransaction
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | String value. API token. |
FcmToken | Optional | String value. Mobile FCM Token. |
currencyCode | Optional | String value. currency code of your country as an ISO 4217 alpha code. The default code is QAR. If you want to support more thant one currency, contact with Maktapp support. |
orderId | Required | String value. A unique identifier for each payment in your application. |
amount | Required | Decimal value. Payment amount that will be deducted from the client's account. |
customerEmail | Required | String value, it should have valid email address format. Clients email address. |
isRecurring | Optional | Boolean value. To indicate the payment is recurring or not. |
customerName | Optional | String value. Clients Name. |
customerPhone | Optional | String value. Clients phone, including country code. |
customerCountry | Optional | String value. Clients country. |
lang | Optional | String value, it should have one of these value{"en","ar"}. Language of checkout page.. Default value is "ar". |
note | Optional | String value. Notes about the payment. |
If all the required parameter are valid, Fatora gateway will return URL of checkout page in a JSON format, like following:
Response JSON
{ "result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX" }
If the value of one parameter are not valid, Fatora gateway will return a response in JSON format containing error code, like following:
Response JSON
{ "result": x } [-1, -2, -3, -6, -8, -10, -20, -21 ]
After getting URL of checkout page, the merchant application should redirect the client to this page, when the client enters his card data in checkout page and clicks on pay button, Fatora gateway will process payment and redirects the client
to success or failure page in the merchant application.
In success case, Fatora gateway will redirect client to merchant success page, and will request the merchant success page with the following parameters
Redirect to success page
Merchat_SUCCESS_URL?orderId=XXX&transId=XXX&token=XXX&mode=XXX
In failure case, Fatora gateway will redirect client to merchant failure page, and will request the merchant failure page with the following parameters:
Redirect to failure page
Merchat_FAILURE_URL?orderId=XXX&transId=XXX&token=XXX&mode=XXX&Failerdescription=XXX
Request Parameters
Parameter | Description |
---|---|
transId | Transaction id of payment created by bank. |
orderId | OrderId of payment(sent by your application at requesting initialize Payment API). |
mode | It has one of the following values {"test", "live"} according to merchant's mode. |
cardToken | Unique identifier extracted from card detail, you will use it to get a new payment from client automatically when the next payments is due. Token still alive six months |
Failerdescription | It describes why the payment is failed. |
Autosave Payment
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/AddTransaction';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'FcmToken' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
'currencyCode' => "XXX",
'orderId' => "XXXXXXX",
'amount' => XXXX,
'customerEmail' => "XXXX",
'customerName' => "XXXX",
'customerPhone' => "XXXX",
'customerCountry' => "XXXX",
'lang' => "ar",
'isRecurring' => false,
'autoSave' => "yes",
'note' => "XXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/AddTransaction ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"FcmToken", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},
{"currencyCode", "XXX"},
{"orderId", "XXXXXXX"},
{"amount", XXX},
{"customerEmail", "XXXX"},
{"customerName", "XXXX"},
{"customerPhone", "XXXX"},
{"customerCountry", "XXXX"},
{"lang", "ar"},
{"isRecurring" false},
{"autoSave" ,"yes"},
{"note", "XXXX"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken ":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode": "XXX",
"orderId": "XXXXXXX",
"amount": XXXX,
"customerEmail": "XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry": "XXXX",
"lang": "ar",
"isRecurring":false,
"autoSave":"yes",
"note": ""
};
$.ajax({
url: 'https://maktapp.credit/v3/AddTransaction',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/AddTransaction
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode":"XXX",
"orderId":"XXXXXXX",
"amount":XXXX,
"customerEmail":"XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry":"XXX",
"lang":"ar",
"isRecurring": false,
"autoSave": "yes",
"note": "XXXX"
}'
The above request will returns JSON structured if all parameters are valid:
{
"result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX"
}
The above request will returns JSON structured if one parameter is null or not valid:
{
"result": x
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows the merchant application to initialize an autosave payment and get the URL of checkout page.
HTTP Request
POST https://maktapp.credit/v3/AddTransaction
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | String value. API token. |
FcmToken | Optional | String value. Mobile FCM Token. |
currencyCode | Optional | String value. currency code of your country as an ISO 4217 alpha code. The default code is QAR. If you want to support more than one currency, contact with Maktapp support. |
orderId | Required | String value. A unique identifier for each payment in your application. |
amount | Required | Decimal value. Payment amount that will be deducted from the client account. |
customerEmail | Required | String value, it should have valid email address format. Client email address. |
autosave | Optional | String value, should have one of the following values {"no", "yes"}. To indicate if it is auto save payment or not. |
customerName | Optional | String value. Client Name. |
customerPhone | Optional | String value. Client phone, including country code. |
customerCountry | Optional | String value. Client country. |
lang | Optional | String value, it should have one of these value{"en","ar"}. Language of checkout page.. Default value is "ar". |
note | Optional | String value. Notes about the payment. |
If all the required parameter are valid, Fatora gateway will return URL of checkout page in a JSON format, like following:
Response JSON
{ "result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX" }
If the values of one parameter are not valid, Fatora gateway will return a response in JSON format containing error code, like following:
Response JSON
{ "result": x } [-1, -2, -3, -6, -8, -10, -20, -21 ]
After getting URL of checkout page, the merchant application redirects the client to this page, when the client enters his card data in checkout page and clicks on pay button, Fatora API will proccess payment and redirects the client to success or failure page.
In success case, Fatora gateway will redirect client to merchant success page, and will request the merchant success page with the following parameters:
Redirect to success page
Merchat_SUCCESS_URL?orderId=XXX&transId=XXX&token=XXX&mode=XXX
In failure case, Fatora gateway will redirect client to merchant failure page, and will call merchant failure page with the following parameters:
Redirect to failure page
Merchat_FAILURE_URL?orderId=XXX&transId=XXX&token=XXX&mode=XXX&Failerdescription=XXX
Request Parameters
Parameter | Description |
---|---|
transId | Transaction id of payment created by bank. |
orderId | OrderId of payment(sent by your application at requesting Initialize API). |
mode | It has one of the following values {"test", "live"} according to merchant mode. |
cardToken | Unique identifier extracted from card detail, you will use it to deduct amount from client directly when he makes another purchase in your application without redirecting him to checkout page. Token still alive six months. |
Failedescription | It describes why the payment is failed. |
Get Card Token
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/AddTransaction';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'FcmToken' => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
'currencyCode' => "XXX",
'orderId' => "XXXXXXX",
'amount' => XXXX,
'customerEmail' => "XXXX",
'customerName' => "XXXX",
'customerPhone' => "XXXX",
'customerCountry' => "XXXX",
'lang' => "ar",
'isRecurring' => true,
'isVoid' => true,
'note' => "XXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/AddTransaction ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"FcmToken", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},
{"currencyCode", "XXX"},
{"orderId", "XXXXXXX"},
{"amount", XXX},
{"customerEmail", "XXXX"},
{"customerName", "XXXX"},
{"customerPhone", "XXXX"},
{"customerCountry", "XXXX"},
{"lang", "ar"},
{"isRecurring" true},
{"isVoid" ,true},
{"note", "testpayment"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken ":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode": "XXX",
"orderId": "XXXXXXX",
"amount": XXXX,
"customerEmail": XXXX,
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry": "XXXX",
"lang": "ar",
"isRecurring":true,
"isVoid":true,
"note": ""
};
$.ajax({
url: 'https://maktapp.credit/v3/AddTransaction',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/AddTransaction
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode":"XXX",
"orderId":"XXXXXXX",
"amount":XXXX,
"customerEmail":"XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry":"XXX",
"lang":"ar",
"isRecurring":true,
"isVoid":true,
"note":"XXXX"
}'
The above request will returns JSON structured if all parameters are valid:
{
"result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX"
}
The above request will returns JSON structured if one parameter is null or not valid:
{
"result": x
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows the merchant application to do the following:
- Initialize a payment.
- Mark this payment as "isvoided at request", so later when Fatora finishs processing payment and the payment successes, Fatora gateway will automatically try to void the payment (return money back to client).
- Get the URL of checkout page.
HTTP Request
POST https://maktapp.credit/v3/AddTransaction
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | String value. API token. |
FcmToken | Optional | String value. Mobile FCM Token. |
currencyCode | Optional | String value. currency code of your country as an ISO 4217 alpha code. The default code is QAR. If you want to support more than one currency, contact with Maktapp support. |
orderId | Required | String value. A unique identifier for each payment in your application. |
amount | Required | Decimal value. Payment amount that will be deducted from the client account. |
customerEmail | Required | String value, it should have valid email address format. Client email address. |
isRecurring | Optional | Boolean value. To indicate the payment is recurring or not. |
autosave | Optional | String value, should have one of the following values {"no","yes"}. To indicate if it is auto save payment or not. |
isVoid | Optional | Boolean value. when this paramter has "true" value, Fatora gatway will try to return deducted amount to client account automatically after successful payment and get card token for the client card. It is used with isrecurring =true or autosave=yes. |
customerName | Optional | String value. Client Name. |
customerPhone | Optional | String value. Client phone, including country code. |
customerCountry | Optional | String value. Client country. |
lang | Optional | String value, it should have one of these value{"en","ar"}. Language of checkout page.. Default value is "ar". |
note | Optional | String value. Notes about the payment. |
If all the required parameter are valid, Fatora gateway will return URL of checkout page in a JSON format, like following:
Response JSON
{ "result": "https://maktapp.credit/pay/MCPaymentPage?paymentID=XXXXXXXXXX" }
If the values of one parameter are not valid, Fatora gateway will return a response in JSON format containing error code, like following:
Response JSON
{ "result": x } [-1, -2, -3, -6, -8, -10, -20, -21 ]
After processing payment and in "SUCCESS" case, if Fatora gateway succeeded in voiding payment, Fatora gateway will redirect client to merchant success page, and will request merchant success page with the following parameters:
Redirect to success page
Merchat_SUCCESS_URL?transid=XXXX&orderId=XXXX&mode=XXXX&refunded=yes&RTransactionID=XXXX&token=XXXX
If Fatora gateway failed in voiding payment, Fatora gateway will redirect client to merchant success page, and will request Merchant Success page with the following parameters:
Redirect to success page
Merchant_Success_URL?transid=XXXX&orderId=XXXX&mode=XXXX&refunded=no&RefundDescription=XXXX&token=XXXX
In failure case, Fatora gateway will redirect client to merchant failure page, and will call merchant failure page with the following parameters:
Redirect to failure page
Merchat_FAILURE_URL?orderId=XXX&transId=XXX&token=XXX&mode=XXX&Failerdescription=XXX
Request Parameters
Parameter | Description |
---|---|
transId | Transaction id of payment created by bank. |
orderId | Ordered of payment(sent by your application at requesting Initialize API). |
mode | It has one of the following values {"test", "live"} according to merchant mode. |
cardToken | Unique identifier extracted from card detail, you will use it to get deduct amount from client directly when he makes another purchase in your application without redirecting him to checkout page. |
refunded | Has one of the following values {"yes" |
RTransactionID | Transaction id of refund process in bank. |
RefundDescription | It describes why the refund request sent by Fatora gateway is failed. |
Failerdescription | It describes why the payment is failed. |
Refund Payment
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/Refund';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'transactionId => "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
'orderId' => "XXXXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/Refund ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"transactionId", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"},
{"orderId", "XXXXXXX"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"transactionId ":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"orderId": "XXXXXXX"
};
$.ajax({
url: 'https://maktapp.credit/v3/Refund',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/Refund
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"orderId":"XXXXXXX",
"transactionID":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}'
The above request will returns JSON structured if all parameters are valid:
{
"result": 1,
"refundState" : XXX ["SUCCESS","Proccessing"],
"mode": XXX ["test","live"],
"refundTrnsactionId": XXXXXX
}
The above request will returns JSON structured if one parameter is null or not valid:
{
"result": x
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows the merchant application to refund a payment.
When Fatora receives a request to refund a payment, Fatora will process this request and send request to bank to return money to client.
Here are two cases:
-
If the refund request date is within 24h of payment date and isn't settled yet, the bank will return money to client directly.
-
If the refund request date is after 24h of payment date or is settled, Fatora will send the request to bank, and the bank will return money back to client within 2-4 weeks.
HTTP Request
POST https://maktapp.credit/v3/Refund
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | String value. API token. |
orderId | Required | String value. A unique identifier for each payment in your application. |
transactionID | Optional | String value. Transaction id of payment created by bank. |
If all the required parameter are valid, Fatora gateway will return result in a JSON format, like following:
Response JSON
{
"result": 1,
"refundState" : XXX ["SUCCESS","Proccessing"],
"mode": XXX ["test", "live"],
"refundTrnsactionId": XXXXXX
}
Response Parameters
Parameter | Description |
---|---|
result | It has value equal one If all the required parameter are valid. Otherwise it has one of the error code values. [-1, -2, -3, -6, -8, -10, -20, -21 ] |
refundState | It has one of the following values {"SUCCESS", "Processing"} "SUCCESS": refund request succeeded and bank returned money back to client. "Processing": refund request succeeded and the request is under processing and the bank will return money back to client within 2-4 weeks. |
mode | It has one of the following values {"test", "live"} according to merchant mode. |
refundTrnsactionId | Transaction id of refund process created by bank. |
If the values of one parameter are not valid, Fatora gateway will return a response in JSON format containing error code, like following:
Response JSON
{ "result": x } [-1, -2, -3, -6, -8, -10, -20, -21 ]
Check Payment Status
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/CheckStatus';
$data = array(
'token' => 'E4B73FEE-F492-4607-A38D-852B0EBC91C9',
'orderId' => 'XXXXXXX'
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/CheckStatus";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData =new System.Collections.Specialized.NameValueCollection();
{
{"token","E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"orderId","XXXXXXX"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
ValidateResponse result= Newtonsoft.Json.JsonConvert.DeserializeObject<ValidateResponse>(resStr);
public class ValidateResponse
{
publicint result { set; get; }
public PaymentDetails payment { set; get; }
}
public class PaymentDetails
{
public string transactionID { set; get; }
public string customerName { set; get; }
public string customerPhone{set;get;}
public decimal PaymentAmount { set; get; }
public string CurrencyCode { set; get; }
public string CustomerEmail { set; get; }
public string PaymentDate { set; get; }
public string Paymentstate { set; get; }
public string Mode { set; get; }
public string auth { set; get; }
public decimal ExchangeRate { set; get; }
public decimal PaidAmount { set; get; }
public string token{set;get;}public decimal description {set;get;}
public bool refundState{set;get;}
public string refundstatus{set;get;} public stringrefundDescription{set;get;}
public string refundTransactionId{set;get;}
}
#POST curl https://maktapp.credit/v3/CheckStatus
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"orderId":"XXXXXXX"
}'
The above request will returns JSON structured if Fatora gateway find the payment:
{
"result": 1,
"payment":
{
"transactionID": "XXXXXXX",
"amount": XXXX,
"currencyCode": "XXX",
"customerEmail": "XXXX",
"customerPhone": "XXXX",
"customerName": "XXXX",
"paymentDate": "XXXX",
"paymentstate": "XXXX" [SUCCESS, PENDING,FAILURE],
"auth" : "XXXX",
"mode": "XXX" [Live, Test] ,
"ExchangeRate":0,
"token":null,
"description":"Transation Successfull",
"refundState":false,
"refundstatus":null,
"refundDescription":null,
"refundTransactionId":null
}
}
Response if Fatora gatway dos not find the payment:
{
"result": 0
}
Response in case one of the request parameters is null or not valid:
{
"result": X
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows merchant application to get payment details, like status [PENDING, SUCCESS, FAILURE], transactionid, amount, currency code, client detail and other details.
You can use this API in each time your success page is requested:
- To ensure that Fatora gateway which issued that request.
- To ignore all the requests after first request, Fatora may request success page page more than once.
HTTP Request
POST https://maktapp.credit/v3/CheckStatus
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | API token. |
orderId | Required | OrderId of payment(sent by your application at requesting initialize Payment API). |
transactionID | Optional | Transactionid of payment. |
Collect Payment For Recurring
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/GetnewPayment';
$data = array(
'token' => "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
'cardToken' => "XXXXXXX"
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/GetnewPayment";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"cardToken","XXXXXXX"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
NewPaymentDetail result = Newtonsoft.Json.JsonConvert.DeserializeObject<NewPaymentDetail >(resStr);
public class NewPaymentDetail
{
public int result { set; get; }
public string transactionID { set; get; }
public string Mode { set; get; }
public string auth { set; get; }
public string description{ set; get; }
}
#POST curl https://maktapp.credit/v3/GetnewPayment
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"cardToken":"XXXXXXX"
}'
The above request will returns JSON structured if fator gateway succeed in getting new payment:
{
"result":1,
"transactionId":"XXXXXXXXXX",
"authcode":"XXXXXXXXXX",
"mode":"test"
}
The above request will returns JSON structured if fator gateway failed in getting new payment:
{
"result":0,
"transactionid":"XXXXXXXXXX",
"description":"failure description"
}
This API allows the merchant application to get a new payment from client using cardToken [for a recurring payment ] when the payment is due, directly without requesting checkout page.
HTTP Request
POST https://maktapp.credit/v3/GetnewPayment
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | API token. |
cardToken | Required | Card token which Fatora gateway send to your application after successful recurring or autosave payment. |
Collect Payment For Autosave
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/GetnewPayment';
$data = array(
'token' => 'E4B73FEE-F492-4607-A38D-852B0EBC91C9',
'cardToken' => 'XXXXXXX',
'orderId' => 'XXXXXXX',
'amount' => XXXX
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/GetnewPayment";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"cardToken","XXXXXXX"},
{"orderId": "XXXXXXX"},
{"amount", XXXX}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
NewPaymentDetail result = Newtonsoft.Json.JsonConvert.DeserializeObject<NewPaymentDetail >(resStr);
public class NewPaymentDetail
{
public int result { set; get; }
public string transactionID { set; get; }
public string Mode { set; get; }
public string auth { set; get; }
public string description{ set; get; }
}
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"cardToken":"XXXXXXX",
"orderId": "XXXXXXX",
"amount": XXXX
};
$.ajax({
url: 'https://maktapp.credit/v3/GetnewPayment',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
#POST curl https://maktapp.credit/v3/GetnewPayment
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"cardToken":"XXXXXXX",
"orderId":"XXXXXXX",
"amount":XXXX
}'
The above request will returns JSON structured if fator gateway succeed in getting new payment:
{
"result":1,
"transactionid":"XXXXXXXXXXXXXXXXXXX",
"authcode":"XXXXXXXXXX",
"mode":"test"
}
The above request will returns JSON structured if fator gateway failed in getting new payment:
{
"result":0,
"transactionid":"XXXXXXXXXXXXXXXXXXX",
"description":"failure description"
}
This API allows the merchant application get new payment from client using cardToken, which your application received after a successful autosave payment for the client.
HTTP Request
POST https://maktapp.credit/v3/GetnewPayment
Request Parameters
Parameter | Restriction | Description |
---|---|---|
token | Required | API token. |
cardToken | Required | Card token which Fatora gateway send to your application after successful recurring or autosave payment. |
amount | Required | Amount to be deducted from client account. |
orderId | Required | A unique identifier for each payment in your application. |
Deactivate Card Token
<? php
init();
function init()
{
$url = 'https://maktapp.credit/v3/StopRecurring';
$data = array(
'token' => 'E4B73FEE-F492-4607-A38D-852B0EBC91C9',
'cardToken' => 'XXXXXXX'
);
$response = curl_post( $url , $data );
$data_json_decode = json_decode($response);
$result = $data_json_decode->{'result'};
return $result;
}
function curl_post($url, array $post = NULL, array $options = array())
{
$defaults = array(
CURLOPT_POST => 1,
CURLOPT_HEADER => 0,
CURLOPT_URL => $url,
CURLOPT_FRESH_CONNECT => 1,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_FORBID_REUSE => 1,
CURLOPT_TIMEOUT => 500,
CURLOPT_POSTFIELDS => http_build_query($post)
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return $result;
}
?>
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 |
SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;
string apiUrl = "https://maktapp.credit/v3/StopRecurring ";
using (WebClient wc = new WebClient())
{
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
System.Collections.Specialized.NameValueCollection postData = new System.Collections.Specialized.NameValueCollection();
{
{"token", "E4B73FEE-F492-4607-A38D-852B0EBC91C9"},
{"cardToken", "XXXXXXX"}
};
var res = wc.UploadValues(apiUrl, postData);
string resStr = Encoding.UTF8.GetString(res);
}
#POST curl https://maktapp.credit/v3/StopRecurring
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"cardToken":"XXXXXXX"
}'
<form>
<input type="button" id="SubmitPay" name="SubmitPay" value="submit" onclick="return pay();" />
</form>
<script>
function pay() {
var dataToPost = {
"token": "E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"cardToken ":"XXXXXXX"
};
$.ajax({
url: 'https://maktapp.credit/v3/StopRecurring',
data: dataToPost,
type: "POST",
dataType: "json",
success: function (res) {
},
error: function (result) {
alert("error: " + result);
}
});
}
</script>
The above request will returns JSON structured if fator gateway succeed in deactivate card token :
{
"result":1
}
The above request will returns JSON structured if fator gateway failed in deactivate card token :
{
"result": "X"
} [-1, -2, -3, -6, -8, -10, -20, -21 ]
This API allows merchant application to disable card token, so merchant application couldn't able to deduct money from the client account using card token.
HTTP Request
POST https://maktapp.credit/v3/StopRecurring
Request Parameters
Parameter | Type | Required (Yes, No) | Description |
---|---|---|---|
token | String | Yes | It is API token. |
cardToken | String | Yes | must be Unique, created by bank for client`s card who set autosave payment type to yes. |
Test
Now Fatora gateway doesn't support test card data, but you can test your application and see the steps of payment using TestMode for your merchant.
- There is two mode for merchant application, Live mode and Test Mode.
to make you merchant in Test mode, contact Maktapp support.
when the merchant is in Test mode, all his payment are in test mode also, and you will not see these payments in your balance in your account in Fatora.
Step of Payment in Test Mode
-
a client clicks on a pay or subscribe button in the merchant application
-
the merchant application sends a request to Fatora gateway to get URL of checkout page.
-
the merchant application redirects the client to this page.
-
the client enters his card data, and clicks pay button in checkout page.
-
Fatora gateway processes payment and redirects client to success page of merchant application if your enter 123 in CVV field in checkout page.
or Fatora gateway redirects client to failure page with failure details if your enter any value other than 123 in CVV field in checkout page but don`t leave it empty.
Card Type
#POST curl https://maktapp.credit/v3/AddTransaction
-H "Content-Type: application/json"
-d ' {
"token":"E4B73FEE-F492-4607-A38D-852B0EBC91C9",
"FcmToken":"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"currencyCode":"XXX",
"orderId":"XXXXXXX",
"amount":XXXX,
"customerEmail":"XXXX",
"customerName":"XXXX",
"customerPhone":"XXXX",
"customerCountry":"XXX",
"lang":"ar",
"note":"XXXX",
"cardType":"XXX" ["credit", "debit", "both"]
}'
- To force your clients paying using a certain type of cards("credit", "debit"), you should pass additional parameter "cardType" at requesting "AddTransaction" as described before.
Possible values for parameter "cardType” are ["credit", "debit", "both"].
This parameter is optional, and the default value of card Type is "both".
-
If you set "cardType" parameter value to "credit", the checkout page will look like this:
-
If you set "cardType” parameter value to "debit", ", the checkout page will look like this:
-
If you set "cardType" paramter value to "both", the checkout page will look like this:
Redirection
From your account in Fatora, you can change your merchant setting, which are the following:
- Success URL, it should be a valid URL without paramters; Fatora gateway will redirect your client to it after successful payment.
- Failure URL, it should be is a valid URL withour paramters; Fatora gateway will redirect your client to it after failed payment.
- Webhook URL, It should be a valid URL withour paramters, webhook will be triggered after processing payment for successful and failed payment.
-
Merchant mode, you can change merchant mode from Test to Live or vice versa.
-
In your Fatora account, click on Integration menu, you can see your API Key (token) and merchant mode (Live or Test)
-
To set or change success or failure URL, click Integration Setting button.
-
After successful payment, Fatora gateway will do the following:
-
Redirect your client to your website by requesting success URL with following parameters.
SucessURl?transid=xxxx&orderId=xxxx
- Trigger your webhook with the following Parameters.
WebhookURL? transid=xxxx&orderId=xxxx&status=SUCCESS
- After failed payment, Fatora gateway will do the following:
- Redirect your client to your website by requesting failure URL with the following parameters.
FailureURL?transid=xxxx&orderId=xxxx&Failuredescription=xxxx
- Tigger your webhook with the following paramters:
WebhookURL?transid=xxxx&orderId=xxxx&status=FAILURE&Failuredescription=xxxx
Errors
<? php
function CheckResponseStatus($result, $msg){
switch ($result){
case -1:
$msg = "Unauthorized -- API key is invaild(not Valid GUID), or incomplete merchant profile.";
break;
case -2:
$msg = "Not Found -- The specified orderId could not be found.";
break;
case -3:
$msg = "Not Support -- merchnat application doesn't support the sent currency code.";
break;
case -7:
$msg = "Not Found -- there isn't any recurring or autosave payment in Fatora gateway for this merchant with the request parameter.";
break;
case -8:
$msg = "Invalid -- Token is not valid guid.";
break;
case -10:
$msg = "Bad Request -- required parameters requested aren't sent in request.";
break;
case -20:
$msg = "Not Found -- There isn't application data for the merchant for the sent currency in payment gateway.";
break;
case -21:
$msg = "Not Support -- payment gateway doesn't support void payment";
break;
default:
$msg = "success";
break;
}
echo $msg;
}
?>
public string CheckResponseStatus(int result)
{
string msg = "";
switch (result)
{
case -1:
msg = "Unauthorized -- API key is invaild(not Valid GUID), or incomplete merchant profile.";
break;
case -2:
msg = "Not Found -- The specified orderId could not be found.";
break;
case -3:
msg = "Not Support -- merchnat application doesn't support the sent currency code.";
break;
case -7:
msg = "Not Found -- there isn't any recurring or autosave payment in Fatora gateway for this merchant with the request parameter.";
break;
case -8:
msg = "Invalid -- Token is not valid guid.";
break;
case -10:
msg = "Bad Request -- required parameters requested aren't sent in request.";
break;
case -20:
msg = "Not Found -- There isn't application data for the merchant for the sent currency in payment gateway.";
break;
case -21:
msg = "Not Support -- payment gateway doesn't support void payment";
break;
default:
msg = "success";
break;
}
Console.WriteLine(msg);
}
<script>
function CheckResponseStatus(result)
{
var msg = "";
switch (result)
{
case -1:
msg = "Unauthorized -- API key is invaild(not Valid GUID), or incomplete merchant profile.";
break;
case -2:
msg = "Not Found -- The specified orderId could not be found.";
break;
case -3:
msg = "Not Support -- merchnat application doesn't support the sent currency code.";
break;
case -7:
msg = "Not Found -- there isn't any recurring or autosave payment in Fatora gateway for this merchant with the request parameter.";
break;
case -8:
msg = "Invalid -- Token is not valid guid.";
break;
case -10:
msg = "Bad Request -- required parameters requested aren't sent in request.";
break;
case -20:
msg = "Not Found -- There isn't application data for the merchant for the sent currency in payment gateway.";
break;
case -21:
msg = "Not Support -- payment gateway doesn't support void payment";
break;
default:
msg = "success";
break;
}
alert(msg);
}
</script>
The Fator API uses the following error codes:
Error Code | Meaning |
---|---|
-1 | Unauthorized -- API key is invaild(not Valid GUID), or incomplete merchant profile. |
-2 | Not Found -- The specified orderId could not be found. |
-3 | Not Support -- merchnat application doesn't support the sent currency code |
-7 | Not Found -- there isn't any recurring or autosave payment in Fatora gateway for this merchant with the request parameter. |
-8 | Invalid -- Token is not valid guid. |
-10 | Bad Request -- required parameters requested aren't sent in request. |
-20 | Not Found -- There isn't application data for the merchant for the sent currency in payment gateway. |
-21 | Not Support -- payment gateway doesn't support void payment |
FAQs
Is card token expired?
-
Yes, it is expired automatically after six month, or if the client card expirs before the end of this 6 month.
-
Yes, it is expired when you call "Deactivate Card Token" API.
Therefore, if you want to collect new payments from the same client, you have to get a new card token again.
What does happen if we generating more than card token?
- All these card tokens ard valid, and you can use any one of them to collect payments from client.
- All these card tokens are expired if the client card expired.
- If you call "Deactivate Card Token" API for certian card token, it is only expired.
Does debit card support recurring payments? - No, debit cards issued in Qatar do not support recurring payments; so if a client try to pay a recurring payment using debit card the payment fails.
Does Fatora gateway validate if "OrderId" is unique at your application level when trying to get checkout page URL?
- No, Fatora gateway validates if "OrderId" paramter has value or not.
Whats are the possible values that "OrderId" paramter could take?
- It is string value, it may contains numbers, chars, comma, dash, etc; it contains any character.
What does the SUCCESS URL and FAILURE URL look like?
-
It looks like the following URL (without parameters):
-
https://www.example.com
-
http://www.example.com
-
http://blog.example.com
-
http://www.example.com/product
-
http://255.255.255.255
Does card token contain special characters?
- Yes, It may contains specail characters, so be carful in reciving and saving it in your application.
What does happen when a client try to open checkout page after paying?
- If the payment succeeded, the client will be redirected to Fatora gateway success page for a few seconds and then will be redirected to your success page.
External Gateway
Fatora gateway provides an external payment integrationt to your E-commerce business.
- Stripe
- QNB
- Cybersource
- QPay
- PayTabs
Start With Fatora External Payment Integration
If you want to subscribe with Fatora for external payment integration, you have to provide Fatora gateway with your account information of your external payment gateway.
1. Stripe gateway account informantion:
For stripe gateway you must send to Fatora the following Information:
- publishable_key,
- secret_key.
2. QNB gateway account informantion:
For QNB gateway you must send to Fatora the following Information:
- merchant_id,
- password.
3. Cybersource gateway account informantion:
For Cybersource gateway you must send to Fatora the following Information:
- merchant_id,
- profile_id,
- access_key,
- secret_key,
- shared_secret_key,
- merchant_defined_data.
4. QPay gateway account informantion:
For QPay gateway you must send to Fatora the following Information:
- gateway_id,
- secret_key.
5. Paytabs gateway account informantion:
For Paytabs gateway you must send to Fatora the following Information:
- merchant_email,
- secret_key,
- site_url.
Plugin
SDK
SDK & API
Wix
Integrate Fatora With Wix Store
Fatora simple and creative payment gateway
import wixSite from 'wix-site-backend';
import wixUsers from 'wix-users';
import {generateLink} from 'backend/generateLink';
import wixLocation from 'wix-location';
$w.onReady(() => {
$w('#button6').label = "⏱ Please wait for the payment URL...";
var adminEmail = "[email protected]";
var payLink = "Not Set"
$w('#thankYouPage1').getOrder().then( (order) => {
var orderNumber = order.number,
orderFrom = order.billingInfo.firstName + " " + order.billingInfo.lastName,
customerEmail = order.billingInfo.email,
amount = order.totals.total,
currency = order.currency;
generateLink(order.totals.total,order.number,order.billingInfo.email).then(result => {
payLink = result;
$w('#buttonID').link = result;
$w('#buttonID').label = "Pay "+ amount + " now ߛҢ;
// check if the user is logged in
if(wixUsers.currentUser.loggedIn) {
const userId = wixUsers.currentUser.id;
wixUsers.emailUser('ibhMail', userId, {
variables: {
"payURL": payLink,
"amount":amount.toString(),
"orderId":orderNumber.toString(),
"name":orderFrom.toString()
}});
}else // then let's use the email he used in the checkout and send him a payment link
{
const subject = "#" + orderFrom + "Payment Link";
const body = `
\rPayment Link: ${encodeURIComponent(payLink)}`;
/* your code here to sendEmail */
}
}).catch(err => console.log(err));
});
});
import {sendWithService} from 'backend/sendGrid';
import wixSite from 'wix-site-backend';
export function sendEmail(subject, body,recipient) {
const key = "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";
const sender = "[email protected]";
return sendWithService(key, sender, recipient, subject, body);
}
import {fetch} from 'wix-fetch';
import wixUsers from 'wix-users-backend';
import wixSite from 'wix-site-backend';
export function getUserName() {
return {
//user_id : wixUsers.currentUser.id,
websiteEmail : wixSite.generalInfo.getEmail(),
websitePhone : wixSite.generalInfo.getPhone()
};
}
export function generateLink(amount,orderId,customerEmail) {
const fatoraApi = "https://maktapp.credit/v3/AddTransaction";
return fetch(fatoraApi, {
method: 'post',
mode: 'cors',
body: JSON.stringify({
token: "Add Your token here",
"amount": amount,
"orderId": orderId,
"customerEmail": customerEmail,
"lang": "ar"
}),
headers: {
"Content-Type": "application/json; charset=utf-8"
}
})
.then(response => response.json())
.then(json => json.result);
}
export function validatePayment(orderId) {
const fatoraApi = "https://maktapp.credit/v3/ValidatePayment";
return fetch(fatoraApi, {
method: 'post',
mode: 'cors',
body: JSON.stringify({
token: "Add your token here",
orderId: orderId
}),
headers: {
"Content-Type": "application/json; charset=utf-8"
}
})
.then(response => response.json())
.then(json => json.payment.paymentstate);
}
import {fetch} from 'wix-fetch';
export function sendWithService(key, sender, recipient, subject, body) {
const url = "https://api.sendgrid.com/api/mail.send.json";
const headers = {
"Authorization": "Bearer " + key,
"Content-Type": "application/x-www-form-urlencoded"
};
const data = `from=${sender}&to=${recipient}&subject=${subject}&text=${body}`;
const request = {
"method": "post",
"headers": headers,
"body": data
};
return fetch(url, request)
.then(response => response.json());
}
You can integrate any Wix website with Fatora wither premium or a free Wix website store.
How It Works? The client buys products from your Wix store now at the default thank page he will get the payment link also he will get an email that contain the payment URL for his order.
Now when user pay for his order and the payment were successfully paid, he will get a confirmation email.
And another email will be sent to the admin store email tell you that a new payment was successfully maid and you MUST change the status of this order at Wix store.
How to do it? - Login to admin dashboard.
- Select the website that you want to add payment gateway.
- Click select and edit store
- Click Edit Site
- Open Dev Mode (Important)
- Go to Thank You Page
- Now you need to add button:
a. Click on add
b. Select Button
c. Select any button you need
-
You need to remember Button id in your mind. we will need id
-
From thank you page open code editor from bottom
-
Delete any code in editor and add this code.
-
In this code search for ButtonID and change it with button id that I told you to save in your mind.
-
Then find adminEmail and change [email protected] to your admin email.
-
From sidebar go to backend and add new web module file.
-
Change name to email.jsw:
a. Add email code.
b. Change sender email from [email protected] to any email you need.
- Create new web module and call it generateLink:
a. Add this code.
b. You will found tow variables call token in this variables add your token.
c. You can change language from lang variable (en or ar) import.
-
Create new web module call it sendGrid and add this code.
-
Click Publish to save updates.
Shopify
You can integrate any shopify website with Fatora just follow this easy steps.
- You should login as admin.
First Add Custom payment
- Step 1: Go to settings.
- Step 2: Click on "Payments".
- Step 3: Scroll down to "Manual payment methods".
- Step 4: Open select box and select "Create custom payment method".
- Step 5: Fill this form as you can see in image then click "Activate".
I think you doing well because now we add a custom payment, continue ……….
Second add our custom code to thanks page
-
Now we will add our custom code to check out thanks page it`s very easy just follow this steps.
-
Step 1: From settings click on fill this form as you can see in image "Checkout".
-
Step 2: Scroll down to "Additional scripts" to add our custom code.
-
Step 3: Add javascript code but don’t forget to change the token to your token.
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous">
</script>
<script>
var token = "Add Your token here";
var payBtn = document.getElementById('gotopay');
function paynow(){
var orderid = ("{{ order_name }}").replace('#','');
var shippingAddress = "{{ shipping_address | format_address }}";
var country = shippingAddress.substring(shippingAddress.indexOf("\n") + 3);
var amount = {{ total_price}} / 100;
var dataToPost = {
"token": token,
"currencyCode": "{{ currency}}",
"orderId": orderid,
"note": "testpayment",
"autoSave ": "Yes",
"customerEmail": "{{ email }}",
"customerCountry": country,
"lang": "ar",
"amount": amount,
"FcmToken": "device fcm_token"
};
$.ajax({
url: 'https://maktapp.credit/v3/AddTransaction',
data: dataToPost,
type: "POST",
datatype: 'json',
cache: false,
success: function (res) {
window.location.href = res.result;
},
error: function (result) {
alert("error: " + result);
}
});
};
</script>
<br><br><br>
<div style="text-align: center;">
<button style=" background-color: #00a2ff; borderradius: 10px; padding: 15px 100px; margin: auto; text-align: center; color: #FFF; fontsize: 22px;" id="gotopay" onclick="paynow()" class="button__text">Pay Now</button>
</div> <br>
-
Step 4: Click save.
-
Great, Now you added the custom code to redirect the client to pay online, Now we have a small step to us, continue …….
Create success and failure pages
In this section you will create two pages one call "success page" and "failure page" to redirect the client after pay.
If he pay success he will redirect to success page else he will redirect to failure page. Let’s
start.
-
Step 1: Click on "Online Store".
-
Step 2: Click on "Pages".
-
Step 3: Create our new page by click on "Add Page".
-
Step 4: Create page pay add page title "Payment success" and content as you can see in image.
-
It’s very easy and don’t forget to click save.
-
Step 5: Create page pay add page title "Payment failure" and content as you can see in image and don’t forget to click save.
-
Well done now we have two pages.
-
Now we need you to share the links of this pages (success & failure) pages so follow these steps to tell you how to do that.
-
Step 1: From this page click on any page you want for example click on "Payment failure".
-
Step 2: You will find the link in bottom of page exactly here (Share this with us).
-
Step 3: Do the same with "Paymen Success" page.
-
Now let me to tell you congratulation because you integrated our payment gateway in your shopify store
For more information use this email to contact with me [email protected]
Prestashop
Fatora Module For Prestashop
Install and Module configuration
- Step 1: for PrestaShop 1.6 Download fatora.zip.
- Step 2: Login to your PrestaShop admin area and select the Modules menu.
- Step 3: Click Upload a module.
- Step 4: Upload the archive fatora.zip via a module installer.
- Step 5: Enable module.
- Step 6: Click configure.
- Step 7: Add your token and click save.
You are done!
Paypal
Integrate Fatora With Paypal
First step get Client ID and Secret from your Paypal account and give these values to Maktapp support.
- Go to https://developer.paypal.com/developer/applications/ and log in with your PayPal business account credentials.
- Navigate to the My Apps & Credentials tab and click the CREATE APP button in the REST API Apps section.
This allows the Cornerstone system to authenticate with PayPal and process refunds. - Name the application (this does not impact the integration) and associate the sandbox test account.
- Click the CREATE APP button.
- The App will be created and the administrator can copy the Client ID and Secret
- The App should be in live mode
a. Step1, add invoice and enable paypal in payment type
b. Step2, open payment page
c. Step3, Click paypal button
d. Step4, After adding your paypal account detail and click pay now, you will be redirected to success or failure page
- In your account in Fatora, the invoice is paid and the payment type is paypal