Checkout button

To enable FawryPay check out button on your website, you need to do the following:

1. Import Fawry JavaScript file in your checkout page

Production Environment:

SandBox Environment:

2. Add the checkout button

<input type="image" onclick="FawryPay.checkout(chargeRequest,successPageUrl, failerPageUrl)"; src="https://www.atfawry.com/assets/img/FawryPayLogo.jpg"/>

Parameters description:

failerPageUrl FawryPay will redirect the customer to this page if the checkout process has been failed .
successPageUrl The Thanks page url FawryPay will redirect the customer to it after the charge request passed successfully

Charge request description:

{ "language":"ar-eg", "merchantCode":"is0N+YQzlE4=", "merchantRefNumber":"12333", "customer":{ "name":"test user", "mobile":"0100739xxx", "email":"test@test.com", "customerProfileId":"8723871236" }, "order":{ "description":"test bill inq", "expiry":"2", "orderItems":[ { "productSKU":"12222", "description":"Test Product", "price":"50", "quantity":"2", "width":"10", "height":"5", "length":"100", "weight":"1" } ] }, "signature":"243d69d005ba46943c5f8d590cf7f8ad6c02663a838ca5b7039c33e03ad10799"}

merchantCode Your identifier on our system; you will have two values, one for the testing, and the other one for the production environment. Ex: 'SHKKRxuqZ5Y='
language The language used by your customer. It should be 'ar-eg' or 'en-gb'
merchantRefNumber A unique identifier for the orders on your system, it will be used on the server to server request which will be sent from our system to yours once the customer pays.
customerName, mobile, email Customer information
customerProfileId Optional feature: The customer identifier id on the merchant site, this value will be stored with each order and will be extracted in order extract.
description The order description which will be printed on POS receipt if the customer pay in Fawry channels, if it is not sent, we will print the merchant name + customer mobile + order items
expiry The merchant needs to set a specific expiry number of hours for the unpaid placed orders.
Order Items
  • productSKU
  • description
  • price
  • quantity
  • width
  • height
  • length
  • weight
signature To avoid the request from being edited by the customer use the request signature by concatenate the follwing elements on the same oder and hash the result using SHA-256
  • merchantCode like ‘Qtq4E61ei9E=’
  • merchantRefNumber
  • Customer profile id if exist
  • Item code
  • Quantity
  • Price in to decimal format like ‘10.00’
  • Expiry hours if exist
  • Secure hash key
3. handle charge response
Success

{ merchantRefNumber:"12333", fawryRefNumber:"912915023", paymentMethod:"PAYATFAWRY", signature:"2df2943c6704176809ba6d559e2906b3d4df14916d63278ab83f408aa3dd24d2" }

  • The above chargeResponse will be passed as a paramter if you call FawryPay.checkoutJS for failerCallBackFunction method
  • The above chargeResponse will be passed as a request paramter if you call FawryPay.checkout

    http://successPageUrl/?chargeResponse={ merchantRefNumber:"12333", fawryRefNumber:"912915023", paymentMethod:"PAYATFAWRY", signature:"2df2943c6704176809ba6d559e2906b3d4df14916d63278ab83f408aa3dd24d2" }

Failer
  • The merchantRefNum will be passed as a paramter if you call FawryPay.checkoutJS for requestCanceldCallBack method
  • The merchantRefNum will be passed as a request paramter if you call FawryPay.checkout

    http://failerPageUrl+'?merchantRefNum=12344'

To process the check out in a new window or in an iframe, you can add the following link. for elements description Click here

https://atfawry.fawrystaging.com/ECommercePlugin/FawryPay.jsp+'?chargeRequest={ "language":"ar-eg", "merchantCode":"is0N+YQzlE4=", "merchantRefNumber":"12333", "customer":{ "name":"test user", "mobile":"0100739xxx", "email":"test@test.com", "customerProfileId":"8723871236" }, "order":{ "description":"test bill inq", "expiry":"2", "orderItems":[ { "productSKU":"12222", "description":"Test Product", "price":"50", "quantity":"2", "width":"10", "height":"5", "length":"100", "weight":"1" } ] }, "signature":"243d69d005ba46943c5f8d590cf7f8ad6c02663a838ca5b7039c33e03ad10799"}&successPageUrl='successPageUrl'&failerPageUrl='failerPageUrl'