Creating Charges API

This service could be used to charge the customer with different payment methods. It also might be used to create a reference number to be paid at Fawry's outlets or it can be used to direct debit the customer card using card token.

Production URL: https://www.atfawry.com/ECommerceWeb/Fawry/payments/charge

Sandbox URL: https://atfawry.fawrystaging.com//ECommerceWeb/Fawry/payments/charge

Sample PAYATFAWRY Charge Request:

{ "merchantCode":"is0N+YQzlE4=", "merchantRefNum":"9990064204", "customerProfileId":"9990064204", "customerMobile":"01000000200", "customerEmail":"77@test.com", "paymentMethod":"PAYATFAWRY", "amount":20.10, "currencyCode":"EGP", "description":"the charge request description", "paymentExpiry":1516554874077, "chargeItems":[ { "itemId":"897fa8e81be26df25db592e81c31c", "description":"asdasd", "price":15.20, "quantity":1 } ], "signature":"fc82831bcd928d22337e9eace61d30c75d6fc027f59f0be571f90ab2231967fa" }

merchantCode The merchant code provided during account setup
merchantRefNum The unique reference number for the charge request in merchant system
customerProfileId The unique customer profile ID in your system
cardToken The card token retrieve in save card step,mandatory in case of CARD payment
customerMobile Optional customer mobile
customerEmail Optional customer email
paymentMethod PAYATFAWRY, CASHONDELIVERY, CARD, WALLET
amount The charge amount
description Item description
paymentExpiry The expiry date for the generated number in case of the used Payment method is PAYATFAWRY
charge Items List of charge items
itemId The id for the charge item
price Item price
quantity The paid quantity
signature The SHA-256 digested for the following concatenated string merchantCode + merchantRefNum + customerProfileId + paymentMethod + amount(in two decimal format 10.00) +cardToken (optional in case of PAYATFAWRY) + secureKey
Sample PAYATFAWRY Response:

{ "type":"ChargeResponse", "referenceNumber":"100163201", "merchantRefNumber":"9990064204", "expirationTime":1516554874077, "statusCode":200, "statusDescription":"Operation done successfully" }

Refund API

You can refund the payment again to the customer by this request

Production Environment:

URL: https://www.FawryPay.com/ECommerceWeb/Fawry/payments/refund

SandBox Environment:

URL: https://FawryPay.fawrystaging.com/ECommerceWeb/Fawry/payments/refund
Refund Request
HTTP method: Post

{ "merchantCode" : "1013969", "referenceNumber" : "322818", "refundAmount" : 100.00, "reason" : "Bad Quality ", "signature": "e075f9f579f3fcf0c8d4981cb90de660e90e9547cf350f934b5c1cd8a27f510d" }

merchantCode The merchant code provided during account setup
referenceNumber The customer order reference number
refundAmount The required amount to be refunded
reason The reason of the refund
signature The SHA-256 digested for the following concatenated string merchantCode + fawryRefNumber + refund amount in two decimal format+ refund reason if exist + secureKey

The response will contain status code and message

{ "type": "ResponseDataModel", "statusCode": 200, "statusDescription": "Operation done successfully", }

200 Success
9901 merchant code is blank or invalid
9938 Order not found
9946 blank or invalid signature
9935 Refunded amount greater than paid amount
9954 Order is not paid