Fawry
Start accepting payments using Fawry, a favorite payment method in Egypt.
To start accepting Fawry payments, please contact your customer success manager.
Request a payment
The POST request
Use the details below to set up your request.
Endpoints
POSThttps://api.checkout.com/payments
POSThttps://api.sandbox.checkout.com/payments
Header parameters
Header | Value |
---|---|
REQUIRED |
|
REQUIRED | application/json |
Body parameters
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.
Field name | Description |
---|---|
INTEGER REQUIRED | The payment amount |
STRING REQUIRED | The currency in which the payment is being made (three-letter ISO 4217 code). Set this to EGP . |
OBJECT REQUIRED | Details about the payment source |
STRING REQUIRED | The type of payment source. Set this to fawry . |
STRING REQUIRED | A description of the payment. Less than or equal to 265 characters. |
STRING REQUIRED | The customer's mobile number. The number must:
|
STRING REQUIRED | The customer's email address. |
STRING OPTIONAL | The profile ID that the merchant has assigned to the customer. Alphanumeric characters only. |
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. |
ARRAY REQUIRED | An array of Fawry product objects. |
STRING REQUIRED | The product's ID. Less than or equal to 265 characters. |
INTEGER REQUIRED | The quantity of product being purchased. |
INTEGER REQUIRED | The unit price of the product. |
STRING REQUIRED | A description of the product. Less than or equal to 265 characters. |
Request example
{
"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 POST 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.
Get details about a payment
You can retrieve details about an existing Fawry payment with the following endpoint.
The GET request
Endpoints
GEThttps://api.checkout.com/payments/{payment_id}
GEThttps://api.sandbox.checkout.com/payments/{payment_id}
Header and path parameters
Header | Value |
---|---|
REQUIRED |
Use the valid secret key of your Checkout.com account. You can find this in the Hub. |
REQUIRED | application/json |
Path | Value |
---|---|
REQUIRED | The payment ID found in the response of the initial response. |
The GET response
Response example
{
"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"
}
}
}
Refund a payment
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.
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).
Testing Fawry
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.
The following endpoints are for testing purposes only. They will not work in the live environment.
You can use the two following endpoints to test capturing and canceling a payment in our sandbox environment.
Get payment details
First, you will need to get the details of payment (as above) and make a note of the reference_number
in the response.
Capture a payment
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
Header | Value |
---|---|
REQUIRED |
|
REQUIRED | application/json |
Path | Value |
---|---|
| 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
Header | Value |
---|---|
REQUIRED |
Use the valid secret key of your Checkout.com account. You can find this in the Hub. |
REQUIRED | application/json |
Path | Value |
---|---|
| The reference number you received in the response to the 'get payment details' request. |
If successful, you will receive a payment_canceled
webhook notification.
Can we help?
Thanks for using Checkout.com. If you need help or have a question, message our Support team at support@checkout.com.