Start accepting payments using Fawry, a favorite payment method in Egypt.
To start accepting Fawry payments, please contact your customer success manager.
Authorization
Required
secret key
Use the valid secret key of your Checkout.com account. You can find this in the Hub.
Content-Type
Required
application/json
The table below describes the minimum recommended fields. You can find the full list, as well as complete request and response examples, in our API reference.
amount
Integer
required
The payment amount in the main currency.
currency
string
required
The currency in which the payment is being made (three-letter ISO 4217 code). Set this to EGP
.
source
Object
required
Details about the payment source.
source.type
String
required
The type of payment source. Set this to fawry
.
source.description
String
required
A description of the payment.
<= 265 characters
source.customer_mobile
String
required
The customer's mobile number. The number must:
- Contain only digits. No spaces, dashes, etc.
- Be an Egyptian mobile number.
- Not include the country code.
- Be 11 digits in total, starting with the three-digit operator code.
source.customer_email
String
required
The customer's email address.
source.customer_profile_id
String
optional
The profile ID that the merchant has assigned to the customer.
Alphanumeric characters only.
source.expires_on
String
optional
Use to set a date and time (UTC, in ISO 8601 format) on which the payment will expire.
This overrides the expiration period you specified during onboarding.
source.products
Array<product>
Required
An array of Fawry product objects.
product.product_id
String
required
The product's ID.
<= 265 characters
product.quantity
Integer
required
The quantity of product being purchased.
product.price
Integer
required
The unit price of the product.
product.description
String
required
A description of the product.
<= 265 characters
{
"amount": 1000,
"currency": "EGP",
"source": {
"type": "fawry",
"description": "Fawry Demo Payment",
"customer_mobile": "01058375055",
"customer_email": "bruce@wayne-enterprises.com",
"products": [
{
"product_id": "0123456789",
"quantity": 1,
"price": 1000,
"description": "Fawry Demo Product"
}
]
}
}
The response
If you receive a 202 Success
response containing a status
field set to Pending
, your request was successful.
In addition, you will receive payment_pending
and payment_capture_pending
webhook notifications. And, when the customer completes the Fawry payment in a timely manner at a point of sale, you will get a payment_captured
webhook notification to confirm that the payment has completed.
Response example
{
"id": "pay_xksrrfuzksge5gyyqubpgbn7gy",
"status": "Pending",
"customer": {
"id": "cus_v65kd7q5tojehd23eftbaiktru"
},
"_links": {
"self": {
"href": "https://api.sandbox.checkout.com/payments/pay_xksrrfuzksge5gyyqubpgbn7gy"
}
}
}
Payment capture, expiration and cancellation
The payment will remain pending for the duration that you agreed when you onboarded your business with Fawry, or until the date and time you set for expires_on
. If the customer fails to complete the transaction at a point of sale by then, the payment will expire and you will receive a payment_expired
webhook notification. If, for any reason, the payment gets canceled before being captured or expiring, you will receive the payment_canceled
webhook notification instead. Make sure that your products and/or services are not shipped and/or provided before receiving confirmation of the capture.
You can retrieve details about an existing Fawry payment with the following endpoint.
The request
Use the details below to set up your request.
Endpoints
Live
Sandbox
Header and path parameters
Authorization
Required
secret key
Use the valid secret key of your Checkout.com account. You can find this in the Hub.
Content-Type
Required
application/json
payment_id
Required
The payment ID found in the response of the initial payment.
{
"id": "pay_xksrrfuzksge5gyyqubpgbn7gy",
"requested_on": "2019-05-27T14:10:32Z",
"source": {
"type": "fawry",
"description": "Fawry Demo Payment",
"reference_number": "1019734277"
},
"amount": 1000,
"currency": "EGP",
"payment_type": "Regular",
"status": "Pending",
"risk": {
"flagged": false
},
"customer": {
"id": "cus_v65kd7q5tojehd23eftbaiktru"
},
"_links": {
"self": {
"href": "https://api.sandbox.checkout.com/payments/pay_xksrrfuzksge5gyyqubpgbn7gy"
}
}
}
Fawry supports both partial (see note below for details) and full refunds. You can refund a payment through the Hub or by using the refund API.
Note on Fawry refunds
Only one refund action may be taken on a Fawry payment, meaning that if you carry out a partial refund, you cannot then refund any more, even if there is some amount left. In addition, Fawry refunds are always rounded down to the nearest whole number. For example, attempting to refund a payment amount of 10999 (EGP 109.99) will only refund 10900 (EGP 109.00).
To start testing, you'll need to:
- create a test account, and
- contact your customer success manager or integrations engineer to activate Fawry payments in the sandbox environment.
You can use the two following endpoints to test capturing and canceling a payment in our sandbox environment.
Endpoints for testing only
The following endpoints are for testing purposes only – they will not work in the live environment.
Get payment details
First, you will need to get the details of a payment and make a note of the reference_number
in the response.
Capture a payment
You can now use the reference_number
from the above response to test capturing a payment.
Endpoint
PUThttps://api.sandbox.checkout.com/fawry/payments/{reference_number}/approval
Header and path parameters
Authorization
Required
secret key
Use the valid secret key of your Checkout.com account. You can find this in the Hub.
Content-Type
Required
application/json
reference_number
Required
The reference number you received in the response to the get payment details request.
If successful, you will receive a payment_captured
webhook notification.
Cancel a payment
Use the reference_number
from the response to your get payment details request to test canceling a payment.
Endpoint
PUThttps://api.sandbox.checkout.com/fawry/payments/{reference_number}/cancellation
Header and path parameters
Authorization
Required
secret key
Use the valid secret key of your Checkout.com account. You can find this in the Hub.
Content-Type
Required
application/json
reference_number
Required
The reference number you received in the response to the get payment details request.
If successful, you will receive a payment_canceled
webhook notification.
Thanks for using Checkout.com. If you need any help or just have a question, please get in touch with our support team at support@checkout.com.