Online Platformi-frameHosted Payment PageDirect APIsGetting StartedTokenizationAccept paymentsMobile ApplicationAndroid SDKGetting StartedTokenizationAccept paymentsE-commerce PlatformGetting StartedWoo-commerceMagentoPrestaShopAPI ReferenceTesting
Online Platform
Kashier provides you with 3 Payment Integration methods for your online platform. You can integrate using prebuilt checkout forms or direct APIs.
i-frame
No redirection
Prebuilt
Fast & easy integration
Embedded form (soon)
No redirection
Customizable
Fast & easy integration
Hosted Payment Page
Redirection
Prebuilt
Fast & easy integration
i-frame
The i-frame is a checkout  popup window which opens on-top of  your payment page. This method is recommended if you prefer a fast and easy way of integration without any customizations.
The i-frame is a prebuilt payment form, which is easy to integrate in only 4 steps. You can test the form by generating a Test API Key.
1. Setup your Kashier account
Sign up to create a Kashier account
2. Generate an API Key
You can generate single/multiple i-frame API Keys as per your acceptance channels.
  • Login to Kashier platform
  • Navigate to Integrate now page
  • Click on Generate for i-frame service
3. Create order hash
Order hashing is a prerequisite for order creation, which acts as a validation layer of what your customer is purchasing and order amount. Order hash generation uses HMAC SHA256.
//Copy and paste this code in your Backend
let crypto = require("crypto");
function generateKashierOrderHash(order){
const mid = "MID-46-111";
const amount = order.amount;
const currency = order.currency;
const orderId = order.merchantOrderId;
const secret = "yourServiceSecretKey";
const path = `/?payment=${mid}.${orderId}.${amount}.${currency}`;
const hash = crypto.createHmac('sha256', secret).update(path).digest('hex');
return hash;}
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
//Copy and paste this code in your Backend
function generateKashierOrderHash($order){
$mid = "MID-46-111";
$amount = $order->amount;
$currency = $order->currency;
$orderId = $order->merchantOrderId;
$secret = "yourServiceSecretKey";
$path = "/?payment=.".$mid.".".$orderId.".".$amount.".".$currency;
$hash = hash_hmac( 'sha256' , $path , $secret ,false);
return $hash; }
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
#Copy and paste this code in your Backend
import hmac
import hashlib
import binascii
def generateKashierOrderHash(order):
   mid = "MID-46-111";
   amount = order['amount']
   currency = order['currency']
   orderId = order['merchantOrderId']
   path = '/?payment={}.{}.{}.{}'.format( mid, orderId, amount, currency )
   path = bytes(path, 'utf-8')
   secret = "yourServiceSecretKey"
secret = bytes(secret, 'utf-8')
return hmac.new(secret, path, hashlib.sha256).hexdigest()
#The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
//Copy and paste this code in your Backend
using System.Security.Cryptography;
public class Kashier
{
     public static string create_hash()
     {
         string mid = "MID-46-111";
         string amount = "20";
         string currency = "EGP";
         string orderId = "99";
         string secret = "Secret Key";
         string path = "/?payment=" + mid + "." + orderId + "." + amount + "." + currency;
         string message;
         string key;
         key = secret;
         message = path;
         System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
         byte[] keyByte = encoding.GetBytes(key);
         byte[] messageBytes = encoding.GetBytes(message);
         HMACSHA256 hmacmd256 = new HMACSHA256(keyByte);
         byte[] hashmessage = hmacmd256.ComputeHash(messageBytes);
         return ByteToString(hashmessage).ToLower();
     }
     public static string ByteToString(byte[] buff)
     {
         string sbinary = "";
         for (int i = 0; i < buff.Length; i++)
         {
         sbinary += buff[i].ToString("X2"); // hex format
         }
         return (sbinary);
     }
   }
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
Parameters:
mid (string) Your Kashier Merchant ID
amount (string) Order amount
currency (string) Order currency (ISO: "EGP", "USD", "GBP" "EUR")
orderId (string) Unique Order Identifier
4. Add code snippet to your website
Fill in your order attributes, then add the following code snippet to your website.
<script id="kashier-iFrame"
src="https://iframe.payformance.io/js/kashier-checkout.js"
data-amount="ORDER-AMOUNT"
data-description="description"
data-hash="ORDER-HASH"
data-currency="ORDER-CURRENCY"
data-orderId="ORDER-ID"
data-merchantId="MID-91-106"
data-merchantRedirect="https://youwebsite/yourCallBack"
//data-merchantRedirect should be "URI encoded"
data-store = "XYZ"
data-type = "external"
data-display="en">
</script>
Parameters:
data-merchantId (string) Your Kashier Merchant ID
data-amount (string) Order amount
data-hash (string) Order hash generated in Step 3
data-currency (string) Order currency
data-orderId (string) Unique Order Identifier
data-merchantRedirect (string) data-merchantRedirect should be "URI encoded
data-store (string)
Hosted Payment Page
The Hosted Payment Page is a payment form with a redirection checkout experience. This form is built for merchants without platforms, interested in a fast and easy method integration.
1. Setup your Kashier account
Sign up to create a Kashier account
2. Generate an API Key
You can generate single/multiple i-frame API Keys as per your acceptance channels.
  • Login to Kashier platform
  • Navigate to Integrate now page
  • Click on Generate for Hosted Payment Page service
3. Create order hash
Order hashing is a prerequisite for order creation, which acts as a validation layer of what your customer is purchasing and order amount. Order hash generation uses HMAC SHA256.
//Copy and paste this code in your Backend
let crypto = require("crypto");
function generateKashierOrderHash(order){
const mid = "MID-46-111";
const amount = order.amount;
const currency = order.currency;
const orderId = order.merchantOrderId;
const secret = "yourServiceSecretKey";
const path = `/?payment=${mid}.${orderId}.${amount}.${currency}`;
const hash = crypto.createHmac('sha256', secret).update(path).digest('hex');
return hash;}
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
//Copy and paste this code in your Backend
function generateKashierOrderHash($order){
$mid = "MID-46-111";
$amount = $order->amount;
$currency = $order->currency;
$orderId = $order->merchantOrderId;
$secret = "yourServiceSecretKey";
$path = "/?payment=.".$mid.".".$orderId.".".$amount.".".$currency;
$hash = hash_hmac( 'sha256' , $path , $secret ,false);
return $hash; }
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
#Copy and paste this code in your Backend
import hmac
import hashlib
import binascii
def generateKashierOrderHash(order):
   mid = "MID-46-111";
   amount = order['amount']
   currency = order['currency']
   orderId = order['merchantOrderId']
   path = '/?payment={}.{}.{}.{}'.format( mid, orderId, amount, currency )
   path = bytes(path, 'utf-8')
   secret = "yourServiceSecretKey"
secret = bytes(secret, 'utf-8')
return hmac.new(secret, path, hashlib.sha256).hexdigest()
#The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
//Copy and paste this code in your Backend
using System.Security.Cryptography;
public class Kashier
{
     public static string create_hash()
     {
         string mid = "MID-46-111";
         string amount = "20";
         string currency = "EGP";
         string orderId = "99";
         string secret = "Secret Key";
         string path = "/?payment=" + mid + "." + orderId + "." + amount + "." + currency;
         string message;
         string key;
         key = secret;
         message = path;
         System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
         byte[] keyByte = encoding.GetBytes(key);
         byte[] messageBytes = encoding.GetBytes(message);
         HMACSHA256 hmacmd256 = new HMACSHA256(keyByte);
         byte[] hashmessage = hmacmd256.ComputeHash(messageBytes);
         return ByteToString(hashmessage).ToLower();
     }
     public static string ByteToString(byte[] buff)
     {
         string sbinary = "";
         for (int i = 0; i < buff.Length; i++)
         {
         sbinary += buff[i].ToString("X2"); // hex format
         }
         return (sbinary);
     }
   }
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
Parameters:
mid (string) Your Kashier Merchant ID
amount (string) Order amount
currency (string) Order currency (ISO: "EGP", "USD", "GBP" "EUR")
orderId (string) Unique Order Identifier
4. Add code snippet to your website
Fill in your order attributes, then add the following code snippet to your website.
https://iframe.payformance.io/payment?mid=MID-46-111&orderId=ORDER-ID&amount=ORDER-AMOUNT&currency=ORDER-CURRENCY&hash=ORDER-HASH&merchantRedirect=YOUR-SUCCESS-CALLBACK-URL
Parameters:
mid (string) Your Kashier Merchant ID
amount (string) Order amount
hash (string) Order hash generated in Step 3
currency (string) Order currency (ISO: "EGP", "USD", "GBP" "EUR")
orderId (string) Unique Order Identifier
merchantRedirect (string) Your callback URL - should be URI encoded
Direct APIs
Getting Started
To be able to integrate directly with Kashier APIs, you'll need to go through the following steps,
1. Setup your Kashier account
Sign up to create a Kashier account
2. Generate an API Key
You can generate single/multiple customizable form service API Keys as per your acceptance channels.
  • Login to Kashier platform
  • Navigate to Integrate now page
  • Click on Generate for Customizable form service
3. Create order hash
Order hashing is a prerequisite for order creation, which acts as a validation layer of what your customer is purchasing and order amount. Order hash generation uses HMAC SHA256.
const path = `/?payment=${mid}.${orderId}.${amount}.${currency}`;
const hash = crypto.createHmac('sha256', secret).update(path).digest('hex');
return hash;}
//The Result Hash for /?payment=mid-0-1.99.20.EGP with secret 11111 should result 606a8a1307d64caf4e2e9bb724738f115a8972c27eccb2a8acd9194c357e4bec
Parameters:
mid (string) Your Kashier Merchant ID
amount (string) Order amount
currency (string) Order currency (ISO: "EGP", "USD", "GBP" "EUR")
orderId (string) Unique Order Identifier
4. Environment Base URL
Please make sure to use one of the following Base URLs to integrate with our APIs.
Test mode https://test-iframe.kashier.io/
Live mode https://iframe.kashier.io/
Tokenization
Kashier provides you with 3 tokenization methods, where you can save card data as tokens based on your use case.
Multi-step Checkout form
(Temporary Card Token)
Expires in 10 minutes
Single-use
Save Card for Later
(Permanent Card Token)
Doesn't expire
Multi-use
Pay and Save card
(Permanent Card Token)
Doesn't expire
Multi-use
Multi-step Checkout form (Temporary Card Token)
Temporary Card Tokens are used for multi-step checkout forms, where you can save your customers card details across your checkout pages. Temporary card tokens expire in 10 minutes.
{
"hash":"dec4d0cae3e9206c42c0c9297337be1d2273385ea135a7fb76227b1a135b193a", 
"merchantId":"MID-45-60",
"card_holder_name": "John Doe",
"card_number": "5111111111111118",
"ccv": "100",
"expiry_month": "05",
"expiry_year": "20",
"shopper_reference": "yourShopperId",
"tokenValidity":"temp"
}
Parameters:
hash (string) Order hash generated in Step 3
merchantId (string) Your Kashier Merchant ID
card_holder_name (string) Cardholder name
card_number (string) Card PAN number
CVV (string) Card Verification Value/Code
expiry_month (string) Card expiry month
expiry_year (string) Card expiry year
shopper_reference (string) Your customer ID/reference
tokenValidity (string) Validity period of token (perm: permanent, temp: temporary)
Response:
{
  "status":200,
  "body":{
     "response":{
        "cardToken":"11da69bc-a846-42ea-a9b2-b47a31a9f2d0",
        "cardHolderName":"John Doe",
        "maskedCard":"************1118",
        "expiry_month":"05",
        "expiry_year":"20"
     },
     "status":"SUCCESS"
  }
}
Hash Failure Response:
{
  "error":{
     "cause":"invalid inputs"
  },
  "status":"FAILURE"
}
Save Card for Later (Permanent Card Token)
Permanent Card Tokens are mainly used for card-on file payments, where you can charge your customers multiple times without prompting them to enter their card details for each payment. Permanent card tokens don’t expire.
{
"hash":"dec4d0cae3e9206c42c0c9297337be1d2273385ea135a7fb76227b1a135b193a", 
"merchantId":"MID-45-60",
"card_holder_name": "John Doe",
"card_number": "5111111111111118",
"ccv": "100",
"expiry_month": "05",
"expiry_year": "20",
"shopper_reference": "yourShopperId",
"tokenValidity":"perm"
}
Parameters:
hash (string) Order hash generated in Step 3
merchantId (string) Your Kashier Merchant ID
card_holder_name (string) Cardholder name
card_number (string) Card PAN number
CVV (string) Card Verification Value/Code
expiry_month (string) Card expiry month
expiry_year (string) Card expiry year
shopper_reference (string) Your customer ID/reference
tokenValidity (string) Validity period of token (perm: permanent, temp: temporary)
Response:
{
  "status":200,
  "body":{
     "response":{
        "cardToken":"11da69bc-a846-42ea-a9b2-b47a31a9f2d0",
        "cardHolderName":"John Doe",
        "maskedCard":"************1118",
        "expiry_month":"05",
        "expiry_year":"20"
     },
     "status":"SUCCESS"
  }
}
Pay and Save card (Permanent Card Token)
This is the recommended payment integration method, as it enables you to pay and save card data for later use. This method tokenizes cards permanently.
{
  "amount":"1",
  "card_holder_name":"ibrahim",
  "card_number":"5111111111111118",
  "ccv":"100",
  "currency":"EGP",
  "display":"en",
  "expiry_month":"05",
  "expiry_year":"21",
  "hash":"5c4607f52d695901c4e6e0c0e3cbc72a21c0e465495a3ade9030c1dbe39d40c9",
  "merchantId":"MID-125-661",
  "merchantRedirect":" ",
  "orderId":"60663",
  "saveCard":true,
  "serviceName":"customizableForm",
  "shopper_reference":"Meena_1"
}
Parameters:
amount (string) Your order amount
card_holder_name (string) Cardholder name
card_number (string) Card PAN number
CVV (string) Card Verification Value/Code
currency (string) Your order currency (ISO: “EGP”, “USD”, “GBP”, “EUR”)
display (string) Should be “en”
expiry_month (string) Card expiry month
expiry_year (string) Card expiry year
hash (string) Order hash generated in Step 3
merchantId (string) Your Kashier Merchant ID
merchantRedirect (string) data-merchantRedirect should be "URI encoded
orderId (string) Your order Identifier
saveCard (string) Enum: should be “True”
serviceName (string) Should be: “customizableForm
shopper_reference (string) Your customer ID/reference
Response:
{
  "status":"SUCCESS",
  "response":{
     "sourceOfFunds":{
        "provided":{
           "card":{
              "3DSecure":{
                 "processACSRedirectURL":"https://test-iframe.payformance.io/3ds/3a7d7683-a5bc-4bcc-b825-55e11e38ab18/d46b2c2b-6cd6-4baf-b7cc-623d915dc9e3/MID-125-661/mpgs/EGP",
                 "3DSecureId":"3DSecureId-d46b2c2b-6cd6-4baf-b7cc-623d915dc9e3"
              },
              "cardInfo":{
                 "cardDataToken":"282fe2f7-6189-42f6-bae6-ec4f99a66a55",
                 "ccvToken":"8cbc374c-d4b3-4306-a767-4dcc7f3a2428",
                 "cardHolderName":"ibrahim",
                 "cardHash":"b506253054c1bd027e272d6f9bf78cdb5087d4c7e56f5c2be7a45361ea274b1c",
                 "cardBrand":"Mastercard",
                 "maskedCard":"511111******1118"
              },
              "transaction":{               }
           }
        },
        "type":"CARD"
     },
     "card":{
        "cardInfo":{
           "cardDataToken":"282fe2f7-6189-42f6-bae6-ec4f99a66a55",
           "ccvToken":"8cbc374c-d4b3-4306-a767-4dcc7f3a2428",
           "cardHolderName":"ibrahim",
           "cardHash":"b506253054c1bd027e272d6f9bf78cdb5087d4c7e56f5c2be7a45361ea274b1c",
           "cardBrand":"Mastercard",
           "maskedCard":"511111******1118"
        },
        "order":{         },
        "amount":1,
        "currency":"EGP",
        "result":"SUCCESS",
        "merchant":{
           "merchantRedirectUrl":" ?paymentStatus=SUCCESS&cardDataToken=&maskedCard=511111******1118&merchantOrderId=60663&orderId=3a7d7683-a5bc-4bcc-b825-55e11e38ab18&cardBrand=&orderReference=TEST-ORD-6432&transactionId=TX-1256611208&amount=1&currency=EGP&signature=846e5a458b30b0bc5ad416394ea1f5bd13a85b62b0d7599e9b6115d11fbcad03"
        }
     },
     "orderReference":"TEST-ORD-6432",
     "orderId":"3a7d7683-a5bc-4bcc-b825-55e11e38ab18",
     "transactionId":"TX-1256611208",
     "merchantOrderId":"60663",
     "creationDate":"2019-11-18T14:47:25.480Z",
     "providerType":"mpgs",
     "method":"card",
     "apiKeyId":"5d837092be613d001c25f5b6"
  },
  "messages":{
     "en":"Congratulations! Your payment was successful",
     "ar":"تهانينا , لقد تم الدفع بنجاح"
  }
}
List Saved Card Tokens
The ability to retrieve all shoppers saved/tokenized card tokens.
 /tokens?mid=${MerchantId}&shopper_reference=${shopper_reference}&hash=${hash}
Accept Payments
Pay and Save Card
Permanently
Pay with Permanent Card
Token
Pay with Temporary Card
Token
Pay and Save card
This is the recommended payment integration method, as it enables you to pay and save card data for later use. This method tokenizes cards permanently.
{
  "amount":"1",
  "card_holder_name":"ibrahim",
  "card_number":"5111111111111118",
  "ccv":"100",
  "currency":"EGP",
  "display":"en",
  "expiry_month":"05",
  "expiry_year":"21",
  "hash":"5c4607f52d695901c4e6e0c0e3cbc72a21c0e465495a3ade9030c1dbe39d40c9",
  "merchantId":"MID-125-661",
  "merchantRedirect":" ",
  "orderId":"60663",
  "saveCard":true,
  "serviceName":"customizableForm",
  "shopper_reference":"Meena_1"
}
Parameters:
amount (string) Your order amount
card_holder_name (string) Cardholder name
card_number (string) Card PAN number
CVV (string) Card Verification Value/Code
currency (string) Your order currency (ISO: “EGP”, “USD”, “GBP”, “EUR”)
display (string) Should be “en”
expiry_month (string) Card expiry month
expiry_year (string) Card expiry year
hash (string) Order hash generated in Step 3
merchantId (string) Your Kashier Merchant ID
merchantRedirect (string) data-merchantRedirect should be "URI encoded
orderId (string) Your order Identifier
saveCard (string) Enum: should be “True”
serviceName (string) Should be: “customizableForm
shopper_reference (string) Your customer ID/reference
Response:
{
  "status":"SUCCESS",
  "response":{
     "sourceOfFunds":{
        "provided":{
           "card":{
              "3DSecure":{
                 "processACSRedirectURL":"https://test-iframe.payformance.io/3ds/3a7d7683-a5bc-4bcc-b825-55e11e38ab18/d46b2c2b-6cd6-4baf-b7cc-623d915dc9e3/MID-125-661/mpgs/EGP",
                 "3DSecureId":"3DSecureId-d46b2c2b-6cd6-4baf-b7cc-623d915dc9e3"
              },
              "cardInfo":{
                 "cardDataToken":"282fe2f7-6189-42f6-bae6-ec4f99a66a55",
                 "ccvToken":"8cbc374c-d4b3-4306-a767-4dcc7f3a2428",
                 "cardHolderName":"ibrahim",
                 "cardHash":"b506253054c1bd027e272d6f9bf78cdb5087d4c7e56f5c2be7a45361ea274b1c",
                 "cardBrand":"Mastercard",
                 "maskedCard":"511111******1118"
              },
              "transaction":{               }
           }
        },
        "type":"CARD"
     },
     "card":{
        "cardInfo":{
           "cardDataToken":"282fe2f7-6189-42f6-bae6-ec4f99a66a55",
           "ccvToken":"8cbc374c-d4b3-4306-a767-4dcc7f3a2428",
           "cardHolderName":"ibrahim",
           "cardHash":"b506253054c1bd027e272d6f9bf78cdb5087d4c7e56f5c2be7a45361ea274b1c",
           "cardBrand":"Mastercard",
           "maskedCard":"511111******1118"
        },
        "order":{         },
        "amount":1,
        "currency":"EGP",
        "result":"SUCCESS",
        "merchant":{
           "merchantRedirectUrl":" ?paymentStatus=SUCCESS&cardDataToken=&maskedCard=511111******1118&merchantOrderId=60663&orderId=3a7d7683-a5bc-4bcc-b825-55e11e38ab18&cardBrand=&orderReference=TEST-ORD-6432&transactionId=TX-1256611208&amount=1&currency=EGP&signature=846e5a458b30b0bc5ad416394ea1f5bd13a85b62b0d7599e9b6115d11fbcad03"
        }
     },
     "orderReference":"TEST-ORD-6432",
     "orderId":"3a7d7683-a5bc-4bcc-b825-55e11e38ab18",
     "transactionId":"TX-1256611208",
     "merchantOrderId":"60663",
     "creationDate":"2019-11-18T14:47:25.480Z",
     "providerType":"mpgs",
     "method":"card",
     "apiKeyId":"5d837092be613d001c25f5b6"
  },
  "messages":{
     "en":"Congratulations! Your payment was successful",
     "ar":"تهانينا , لقد تم الدفع بنجاح"
  }
}
Pay with Permanent Card Token
Kashier enables capturing payments using pre-saved permanent card tokens. Where you don’t have to require your customers to enter their card details before each transaction.
{
  "merchantId":"MID-15-430",
  "shopper_reference":"shopper",
  "cardToken":"ab6fea2b-9c3c-47d2-a497-493b98c915c0",
  "ccvToken":"62d3865e-4573-4acc-9cb4-21947862924f",
  "amount":100,
  "currency":"EGP",
  "display":"en",
  "hash":"92db97152a0fabbfd848e0c3bf884186c181161cfad78ac4e26c8c89f8b28626",
  "orderId":"12334"
}
Parameters:
merchantId (string) Your Kashier Merchant ID
shopper_reference (string) Your customer ID/reference
cardToken (string) Your shopper’s card token
amount (string) Your order amount
currency (string) Your order currency (ISO: “EGP”, “USD”, “GBP”, “EUR”)
display (string) Should be “en”
hash (string) Order hash generated in Step 3
orderId (string) Your order Identifier
serviceName (string) Should be: “customizableForm
Response:
{
  "response":{
     "sourceOfFunds":{
        "provided":{
           "card":{
              "3DSecure":{
                 "processACSRedirectURL":"http://localhost:8888/3ds"
              },
              "transaction":{
                 "recurring":true
              }
           }
        },
        "type":"CARD"
     },
     "card":{
        "amount":“90”,
        "currency":"EGP",
        "result":"SUCCESS",
        "merchant":{
           "merchantRedirectUrl":"?paymentStatus=SUCCESS&cardDataToken=&maskedCard=&merchantOrderId=5dd78c07-6b8a-4b58-9032-6a4eefb5873b&orderId=e4d397b0-bdab-4f3f-9035-98e2848a0d7d&cardBrand=&orderReference=TEST-ORD-3829&transactionId=TX-3454934&amount=90&currency=EGP"
        }
     },
     "orderReference":"TEST-ORD-3829",
     "orderId":"2f6450ea-1418-4975-822c-b5b4e0b79ed2",
     "transactionId":"TX-3454934",
     "merchantOrderId":"5dd78c07-6b8a-4b58-9032-6a4eefb5873b",
     "creationDate":"2019-08-04T22:59:59.395Z",
     "providerType":"mpgs",
     "method":"card",
     "refId":"56ce81d3-789a-4255-8864-beb16023ed94",
     "merchantId":"MID-34-549"
  },
  "messages":{
     "en":"Congratulations! Your payment was successful",
     "ar":" , لقد تم الدفع بنجاح"
  },
  "status":"SUCCESS"
}
Hash Failure Response:
{
  "status":"INVALID_REQUEST",
  "error":{
     "cause":"Invalid Token",
     "explanation":"The used token is not valid"
  }
}
Pay with Temporary Card Token
Kashier enables capturing payments using pre-saved temporary card tokens, which is recommended for multi-step checkout forms.
{
  "merchantId":"MID-15-430",
  "shopper_reference":"shopper",
  "cardToken":"2d69ab51-0573-445e-bd43-b21f3a8a7ce3",
  "amount":100,
  "currency":"EGP",
  "display":"en",
  "hash":"d53ac4393b6bf5adc7a7db346570ffe22f84ae93810d9aec210c1a2e578f4fd5",
  "orderId":"1234",
  "serviceName":"customizableForm"
}
Parameters:
merchantId (string) Your Kashier Merchant ID
shopper_reference (string) Your customer ID/reference
cardToken (string) Your shopper’s card token
ccvToken (string) Your shopper’s ccv Token
amount (string) Your order amount
currency (string) Your order currency (ISO: “EGP”, “USD”, “GBP”, “EUR”)
display (string) Should be “en”
hash (string) Order hash generated in Step 3
orderId (string) Your order Identifier
serviceName (string) Should be: “customizableForm
Response:
{
  "response":{
     "sourceOfFunds":{
        "provided":{
           "card":{
              "3DSecure":{
                 "processACSRedirectURL":"http://localhost:8888/3ds"
              },
              "transaction":{
                 "recurring":true
              }
           }
        },
        "type":"CARD"
     },
     "card":{
        "amount":“90”,
        "currency":"EGP",
        "result":"SUCCESS",
        "merchant":{
           "merchantRedirectUrl":"
?paymentStatus=SUCCESS&cardDataToken=&maskedCard=&merchantOrderId=5dd78c07-6b8a-4b58-9032-6a4eefb5873b&orderId=e4d397b0-bdab-4f3f-9035-98e2848a0d7d&cardBrand=&orderReference=TEST-ORD-3829&transactionId=TX-3454934&amount=90&currency=EGP"
        }
     },
     "orderReference":"TEST-ORD-3829",
     "orderId":"2f6450ea-1418-4975-822c-b5b4e0b79ed2",
     "transactionId":"TX-3454934",
     "merchantOrderId":"5dd78c07-6b8a-4b58-9032-6a4eefb5873b",
     "creationDate":"2019-08-04T22:59:59.395Z",
     "providerType":"mpgs",
     "method":"card",
     "refId":"56ce81d3-789a-4255-8864-beb16023ed94",
     "merchantId":"MID-34-549"
  },
  "messages":{
     "en":"Congratulations! Your payment was successful",
     "ar":" , لقد تم الدفع بنجاح"
  },
  "status":"SUCCESS"
}
Hash Failure Response:
{
  "status":"INVALID_REQUEST",
  "error":{
     "cause":"Invalid Token",
     "explanation":"The used token is not valid"
  }
}
Mobile Application
Android SDK
iOS SDK (soon)
Android SDK
Getting Started
Before using Kashier SDK, you’ll need an API Key and your Kashier Merchant Identifier (MID) through the following steps,
1. Setup your Kashier account
Sign up to create a Kashier account
2. Generate an API Key
You can generate single/multiple customizable form service API Keys as per your acceptance channels.
  • Login to Kashier platform
  • Navigate to Integrate now page
  • Click on Generate for Customizable form service
3. Install the SDK
To integrate the SDK in your platform, you may need to contact our support team to provide you with our library, please follow the following steps.

All the methods used are of type void.
  • Copy kashierSDK.aar file in libs folder
    - you may need to switch view to ‘Project’ instead of ‘Android’, you’ll find it under <project_name>/app/libs
  • Open your build.gradle file,  specify the following and click sync project with Gradle files
  • Open Project level build.gradle and add flatDir{dirs 'libs'} like below
allprojects {
  repositories {
      jcenter()
      flatDir {
          dirs 'libs'
      }
  }
}
  • Open app level build.gradle file and add .aar file
dependencies {    
           implementation(name: 'kashierSDK', ext: 'aar')
}
  • Import some dependencies used by the SDK in your build.gradle, use the ones below
dependencies {    
       implementation(name: ‘Kashier_Payment_SDK_1.0.0’, ext: 'aar')    
       implementation fileTree(dir: 'libs', include: ['*.jar'])    
       implementation 'androidx.appcompat:appcompat:1.1.0'    
       implementation 'androidx.constraintlayout:constraintlayout:1.1.3'    
       implementation 'com.google.android.material:material:1.1.0'    
       implementation 'com.squareup.retrofit2:retrofit:2.6.1'    
       implementation 'com.squareup.retrofit2:converter-gson:2.6.1'    
       implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0'
}
  • Sync the Gradle, and you should now be able to use the SDK
4. Initialize the SDK
After completing the above steps successfully, you’ll need to initialize the SDK after integrating with your project as follows,
Kashier.init(   
             Context context,
             String merchantId,
             String apiKey, String currency,
             SDK_MODE sdkMode)
or
Kashier.init(   
            Context context,   
            String merchantId,   
            String apiKey,   
            String currency,   
            SDK_MODE sdkMode,   
            KASHIER_DISPLAY_LANG displayLanguage)
Parameters:
context (context) required Application context
merchantId (string) required Your Kashier Identifier
apiKey (string) required API Key, you can get it from Kashier Portalr
currency (string) required Your order currency (ISO: “EGP”, “USD”, “GBP”, “EUR”)
sdkMode (enum) required Used to decide which URL the SDK will use (staging for development, or production)SDK_MODE(DEVELOPMENT,PRODUCTION)
displayLanguage (enum) optional Display language, used to decide the language in displaying success and error messages, can be changed later KASHIER_DISPLAY_LANG(AR,EN)
Example:
String currency = "EGP";
String ApiKeyId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
String merchantId = "MID-xxx-xxx";
Kashier.init(MainActivity.this, merchantId, ApiKeyId, currency, SDK_MODE.DEVELOPMENT);
Tokenization
The SDK provides you with 2 tokenization methods, where you can save card data as tokens based on your use case.
Multi-step Checkout form
(Temporary Card Token)
Expires in 10 minutes
Single-use
Save Card for Later
(Permanent Card Token)
Doesn't expire
Multi-use
Multi-step Checkout form (Temporary Card Token)
Temporary Card Tokens are used for multi-step checkout forms, where you can save your customers card details across your checkout pages. Temporary card tokens expire in 10 minutes.
saveShopperCard(   
         Card cardData,   
         String shopperReference,   
         TOKEN_VALIDITY tokenValidity,   
         final UserCallback<TokenizationResponse> responseCallback)
Parameters:
cardData (card) required Card details
shopperReference (string) required Your shopper identifier
tokenValidity (enum) required Validity period of token TOKEN_VALIDITY(PERMANENT, TEMPORARY)
responseCallback (userCallback) required Callback for operationUserCallback
Example:
Kashier.saveShopperCard(
                  new Card("YOUR HOLDER NAME", 
                  "XXXXXXXXXXXXXXXX", "XXX", "12", "22"),       
                  "XXXXXXXXXXX", //SHOPPER REFERENCE       
                   TOKEN_VALIDITY.TEMPORARY,       
                   new UserCallback<TokenizationResponse>() {          
                               @Override          
                                public void onResponse(Response<TokenizationResponse> userResponse{          
.                               /*Used to set the token value to be used in next request          
                                * Both these values can be used later in payment with temp tokenization
          
                                */          
                                String cardToken = userResponse.body().getBody().getResponse().getCardToken();          
                                String ccvToken = userResponse.body().getBody().getResponse().getCcvToken();          
                                Log.d(null, "cardToken: " + cardToken + " , ccvToken: " + ccvToken);                   
                                                                              }​           
                                @Override           
                                public void onFailure(ErrorData<TokenizationResponse> errorData) {           
                                Log.e(null, "onFailure: " + errorData.getErrorMessage());                   
                                                                              }               
});
Save Card for Later (Permanent Card Token)
Permanent Card Tokens are mainly used for card-on file payments, where you can charge your customers multiple times without prompting them to enter their card details for each payment. Permanent card tokens don’t expire.
saveShopperCard(   
         Card cardData,   
         String shopperReference,   
         TOKEN_VALIDITY tokenValidity,   
         final UserCallback<TokenizationResponse> responseCallback)
Parameters:
cardData (card) required Card details
shopperReference (string) required Your shopper identifier
tokenValidity (enum) required Validity period of token TOKEN_VALIDITY(PERMANENT, TEMPORARY)
responseCallback (userCallback) required Callback for operationUserCallback
Example:
Kashier.saveShopperCard(
                  new Card("YOUR HOLDER NAME", 
                  "XXXXXXXXXXXXXXXX", "XXX", "12", "22"),       
                  "XXXXXXXXXXX", //SHOPPER REFERENCE       
                   TOKEN_VALIDITY.PERMANENT,       
                   new UserCallback<TokenizationResponse>() {          
                               @Override          
                                public void onResponse(Response<TokenizationResponse> userResponse{          
.                               /*Used to set the token value to be used in next request          
                                * Both these values can be used later in payment with temp tokenization
          
                                */          
                                String cardToken = userResponse.body().getBody().getResponse().getCardToken();          
                                String ccvToken = userResponse.body().getBody().getResponse().getCcvToken();          
                                Log.d(null, "cardToken: " + cardToken + " , ccvToken: " + ccvToken);                   
                                                                              }​           
                                @Override           
                                public void onFailure(ErrorData<TokenizationResponse> errorData) {           
                                Log.e(null, "onFailure: " + errorData.getErrorMessage());                   
                                                                              }               
});
List Saved Card Tokens
The ability to retrieve all pre-saved/tokenized shoppers card tokens. You can use the following API,
listShopperCards(   
            String shopperReference,
            UserCallback<TokensListResponse> TokensListResponseCallback)
Parameters:
shopperReference (string) required Your shopper identifier
TokensListResponseCallback (userCallback) required Callback for operationUserCallback
Example:
Kashier.listShopperCards(       
               "XXXXXXXXXXX",       
               new UserCallback<TokensListResponse>() {         
                         @Override         
                         public void onResponse(Response<TokensListResponse> userResponse) {           
                               try {             
                                  final List<TokensItem> tokenItems = userResponse.body().getResponse().getTokens();             
                                  String[] items = new String[tokenItems.size()];             
                                  for (int i = 0; i < tokenItems.size(); i++) {               
                                             TokensItem tokenItem = tokenItems.get(i);               
                                             items[i] =                       
                                               tokenItem.getCardNumber()                               + " -- "                               +                                                 tokenItem.getCardExpiryMonth()                       + "/"                                  +
                                               tokenItem.getCardExpiryYear()                            + "\n"                               +
                                                tokenItem.getToken();             
                                  }             
                                  Log.d(null, items.toString());           
                                  }
                                  catch (Exception e) {             
                                             this.onFailure(                     
                                             newErrorData<TokensListResponse()                             
                                                           .setErrorType(ERROR_TYPE.EXCEPTION)                             
                                                           .setExceptionErrorMessage(e.toString()));           
                                                           }         
                                 }​         
                                @Override         
                                public void onFailure(ErrorData<TokensListResponse> errorData) {           
                                Log.d(null, errorData.getErrorMessage());         
                                }       
});
Accept Payments
Pay using Kashier Form
Prebuilt
Fast & easy integration
Pay using APIs
Customizable
Fast & easy integration
Pay using Kashier Form
This is a built-in checkout form provided by Kashier, which opens over  your payment page. This method is recommended if you prefer a fast and easy way of integration without any customizations. You can integrate using one of the following APIs.
startPaymentActivity(   
                   Context context,   
                    String shopperReference,   
                    String orderId,   
                    String amount,   
                    UserCallback<PaymentResponse> paymentTransactionsCallback)
or
startPaymentActivity(   
                   Context context,   
                    String shopperReference,   
                    String orderId,   
                    String amount,   
                    UserCallback<PaymentResponse> userCallback,   
                    @Nullable PaymentActivityConfig paymentActivityConfig)
or
startPaymentActivity(   
                   Context context,   
                    String shopperReference,   
                    String orderId,   
                    String amount,   
                    UserCallback<PaymentResponse> paymentTransactionsCallback,   
                    @Nullable Card card,   @Nullable PaymentActivityConfig paymentActivityConfig)

Parameters:
activity (AppCompatActivity) required Activity
shopperReference (string) required Your shopper identifier
orderId (string) required Your unique order identifier
amount (string) required Your order amount
paymentCallback required Callback for userUserCallback
card (Card) optional Card Details, can be used to pre-fill fields on payment form
paymentActivityConfig (PaymentActivityConfig) optional Can be used to pass config
Example:
Kashier.startPaymentActivity(             
                this,             
               "XXXXXXXXXXXXX",             
               "XXXXXX",             
               "234",             
               new UserCallback<PaymentResponse>() {                 
                                   @Override                 
                                   public void onResponse(Response<PaymentResponse> userResponse) {                                                         Log.d(null, userResponse.body().getMessages().getEn());                 
                                   }​                 
                                   @Override                 
                                  public void onFailure(ErrorData<PaymentResponse> errorData) {                     
                                   Log.d(null, errorData.getErrorMessage());                 
                                   }             
                             },
                                   new PaymentActivityConfig()                    
                                                     .setActivityTitle("Kashier Payment")                     
                                                      /**                      *  %1$s => Transfer Amount                      
                                                      *  %2$s => Kashier Currency                      
                                                      */                     .setButtonLabel("PAY NOW %2$s %1$s"))
Pay using APIs
Kashier provides you with 3 payment APIs for direct integration to be used within your checkout form.
Pay
callPaymentAPI(
                   Card cardData,
                   final String orderId,
                   final String amount,
                   final String shopperReference,
                   final Boolean shouldSaveCard,
                   @Nullable UserCallback<PaymentResponse> paymentCallback)
Parameters:
cardData (card) required Card Details used for payment
orderId (string) required Your unique order identifier
amount (string) required Your order amount
shopperReference (string) required Your shopper identifier
shouldSaveCard (boolean) required To decide whether the card should be saved for future use
paymentCallback required Callback for userUserCallback
Example:
Kashier.callPaymentAPI(   
new Card(
"YOUR HOLDER NAME", "XXXXXXXXXXXXXXXX", "XXX", "12", "22"),   "xxxxx", //ORDER ID   "242",
//AMOUNT   "XXXXXX",
//SHOPPER REFERENCE   true,   
new UserCallback<PaymentResponse>() {     
@Override     
public void onResponse(Response<PaymentResponse> userResponse) {       String responseMessage =           ResponseHelper.getResponseMessageTranslated(userResponse.body());       RESPONSE_STATUS responseStatus = ResponseHelper.getResponseStatus(userResponse.body());       switch (responseStatus) {         case SUCCESS:           Log.d(               null,               "Transaction success: "                   + responseMessage                   + userResponse.body().getResponse().getOrderReference());           
break;         
default:           
Log.d(null, "Transaction failed: " + responseMessage);           
break;       }     }     
@Override     
public void onFailure(ErrorData<PaymentResponse> errorData) {       switch (errorData.getErrorType()) {         case VALIDATION:           /**            * Note: Inputs are validated before sending the request, you can use the error            * details as in the example below to handle the validation on the input fields as            * per your requirements            *            * <p>** The card validation includes luhn check, make sure the card you enter is            * valid, or passes a luhn check ** The card expiry date includes check for future date            */           Log.d(null, "Validation error" + errorData.getValidationErrorsMessage());           List<ValidationResult> validationResults = errorData.getValidationErrors();           for (ValidationResult validationResult : validationResults) {             Log.d(                 null,                 "Field: "                     + validationResult.getValidationField().toString()                     + ", Field Error: "                     + validationResult.getValidationErrorCode().toString());             // TODO: Handle validation error as required here
           }            
break;         
case DATA:           // Errors like, order already paid, ....           
Log.d(null, "Error in payment" + errorData.getErrorMessage());           
break;
          
case NETWORK_NO_INTERNET:         
case NETWORK_TIMEOUT:         
case NETWORK_UNAUTHENTICATED:         
case NETWORK_CLIENT_ERROR:         
case NETWORK_SERVER_ERROR:         
case NETWORK_UNEXPECTED_ERROR:           
// Note: you can handle network errors here,           
Log.d(               null,               "Network Error: "                   + errorData.getNetworkErrorCode()                   + " , "                   + errorData.getErrorMessage());           
break;         
case JSON_PARSING_ERROR:         
case EXCEPTION:         default:           
/**            * For any other less common errors, make sure you don't display the exception            * message to the user, it's intended to be used by the developer only            */           
Log.d(               null,               "Unknown expection: "                   + errorData.getErrorMessage()                   + " "                   + errorData.getExceptionErrorMessage());           
break;       }     }   });


Pay using Permanent Token
Kashier enables capturing payments using pre-saved permanent card tokens, where you don’t have to require your customers to enter their card details before each transaction.
You’ll need the cardToken from the response of Save Card for Later (Tokenization) API.
payWithPermanentToken(
                   String shopperReference,
                   String orderId,
                   String amount,
                   String cardToken,
                   UserCallback<PaymentResponse> userCallback)
Parameters:
shopperReference (string) required Your shopper identifier
orderId (string) required Your unique order identifier
amount (string) required Your order amount
cardToken (string) required Your shopper’s card token
paymentCallback required Callback for userUserCallback
Example:
Kashier.payWithTempToken(
"xxxxxxxxx", //SHOPPER REFERENCE
"xxxxxx", //ORDER ID
"622", //AMOUNT
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", //CARD TOKEN
new UserCallback<PaymentResponse>() {
@Override
public void onResponse(Response<PaymentResponse> paymentResponse) { switch (ResponseHelper.getResponseStatus(paymentResponse.body())) { case SUCCESS: Log.d( null, "Trasaction ID: " + paymentResponse.body().getResponse().getTransactionId() + "Order Reference: " + paymentResponse.body().getResponse().getOrderReference());
break;
case UNKNOWN:
case FAILURE:
case INVALID_REQUEST:
case PENDING:
case PENDING_ACTION: default:
Log.d( null, "Transaction Failed:" + ResponseHelper.getResponseMessageTranslated(paymentResponse.body()));
break; } }
@Override
public void onFailure(ErrorData<PaymentResponse> errorData) { Log.d(null, "Transaction failed: " + errorData.getErrorMessage()); } });
Pay using Temporary Token
Kashier enables capturing payments using pre-saved temporary card tokens, which is recommended for multi-step checkout forms.
You’ll need the cardToken and ccvToken from the response of Save Card for Later (Tokenization) API.
payWithTempToken(   
                   String shopperReference,   
                   String orderId,   
                   String amount,   
                   String cardToken,   
                   String cvvToken,   
                   UserCallback<PaymentResponse> userCallback)
Parameters:
shopperReference (string) required Your shopper identifier
orderId (string) required Your unique order identifier
amount (string) required Your order amount
cardToken (string) required Your shopper’s card token
cvvToken (string) required Your shopper’s ccv Token
paymentCallback required Callback for userUserCallback
Example:
Kashier.payWithTempToken(
"xxxxxxxxx", //SHOPPER REFERENCE
"xxxxxx", //ORDER ID
"622", //AMOUNT
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", //CARD TOKEN
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", //CCV TOKEN
new UserCallback<PaymentResponse>() {
@Override
public void onResponse(Response<PaymentResponse> paymentResponse) { switch (ResponseHelper.getResponseStatus(paymentResponse.body())) { case SUCCESS: Log.d( null, "Trasaction ID: " + paymentResponse.body().getResponse().getTransactionId() + "Order Reference: " + paymentResponse.body().getResponse().getOrderReference());
break;
case UNKNOWN:
case FAILURE:
case INVALID_REQUEST:
case PENDING:
case PENDING_ACTION: default:
Log.d( null, "Transaction Failed:" + ResponseHelper.getResponseMessageTranslated(paymentResponse.body()));
break; } }
@Override
public void onFailure(ErrorData<PaymentResponse> errorData) { Log.d(null, "Transaction failed: " + errorData.getErrorMessage()); } });
E-commerce Platform
Woo-commerce
Magento (soon)
PrestaShop
Getting Started
Before using Kashier Plugins, you’ll need an API Key and your Kashier Merchant Identifier (MID) through the following steps,
1. Setup your Kashier account
Sign up to create a Kashier account
2. Generate an API Key
You can generate single/multiple customizable form service API Keys as per your acceptance channels.
  • Login to Kashier platform
  • Navigate to Integrate now page
  • Click on Generate for Customizable form service
Woo-commerce
Kashier Woo-commerce Plugin allows you to accept payments through your e-commerce platform. This Plugin provides you with a seamless integration into your payment page directly on your website.
  • Download Kashier Woocommerce Plugin
  • Login to your Woocommerce Admin dashboard
  • Go to Plugins section, then click Add new
  • In the top-section, upload Kashier Woo-commerce Plugin by clicking on Upload plugin
  • Click on Install Plugin and Activate Plugin
  • Go to Woo-commerce section, then go to Settings
  • Go to Payments section then select Kashier Plugin and enter your Test/Live API Key
  • Click on Save changes and start accepting payments
WordPress
To integrate with Kashier for WordPress platform,
  • Connect to your site’s server using FTP in WordPress
  • Navigate to the wp-content folder within the WordPress installation for your website The location of your WordPress installation can differ with every hosting provider. Make sure that you know the location before you proceed
  • Navigate to the /wp-content/plugins directory
  • Navigate to wp-content. Inside this directory are the plugins and themes directories along with a few others
  • Navigate to the plugins directory. It is inside this directory that all plugins reside
  • Upload the plugin folder to the /wp-content/plugins directory on your web server
  • Install & Activate the plugin, then go to your plugins directory and look for Kashier plugin
  • Go to the plugin's settings and edit the Test/Live API Keys
PrestaShop
Kashier PrestaShop Plugin allows you to accept payments through your e-commerce platform. This Plugin provides you with a seamless integration into your payment page directly on your website.
  • Download Kashier PrestaShop Plugin
  • Login to your PrestaShop Admin dashboard
  • Go to Modules and Services section, then upload Kashier PrestaShop Plugin
  • Enable Plugin and click on configure
  • Click on Test mode checkobx and enter your MID and Test API Key
  • Click on save
Testing
You can use the following cards for testing your integration with Kashier.
Card type Card number Cardholder name
MasterCard 5123450000000008
(3D-Secure Enrolled)
John Doe
2223000000000007
(3D-Secure Enrolled)
5111111111111118
2223000000000023
Visa 4508750015741019
(3D-Secure Enrolled)
4012000033330026
CSC/CVV response codes
CVV Response GW Code
100 MATCH
101 NOT_PROCESSED
102 NO_MATCH
Expiry date response codes
Expiry date Transaction Response Code
05/21 APPROVED
05/22 DECLINED
04/27 EXPIRED_CARD
08/28 TIMED_OUT
01/37 ACQUIRER_SYSTEM_ERROR
02/37 UNSPECIFIED_FAILURE
05/37 UNKNOWN