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 Fawry payment
The request
Use the details below to set up your request.
Endpoints
Live
Sandbox
Header parameters
Header | Value |
---|---|
|
|
|
|
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 |
---|---|
| The payment amount in the main currency. |
| The currency in which the payment is being made (three-letter ISO 4217 code). Set this to |
| Details about the payment source. |
| The type of payment source. Set this to |
| A description of the payment.\ <= 265 characters |
| The customer's mobile number. The number must:
|
| The customer's email address. |
| The profile ID that the merchant has assigned to the customer.\ Alphanumeric characters only. |
| 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. |
| An array of Fawry product objects. |
| The product's ID.\ <= 265 characters |
| The quantity of product being purchased. |
| The unit price of the product. |
| A description of the product.\ <= 265 characters |
Request example
{
"amount": 1000,
"currency": "EGP",
"source": {
"type": "fawry",
"description": "Fawry Demo Payment",
"customer_mobile": "01058375055",
"customer_email": "[email protected]",
"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 apayment_expired
webhook notification. If, for any reason, the payment gets canceled before being captured or expiring, you will receive thepayment_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 Fawry payment
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
Header | Value |
---|---|
|
|
|
|
Path parameter | Description |
---|---|
| The payment ID found in the response of the initial payment. |
The 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 Fawry 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.
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).
Testing Fawry payment actions in sandbox
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
Header | Value |
---|---|
|
|
|
|
Path parameter | Description |
---|---|
| 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 |
---|---|
|
|
|
|
Path parameter | Description |
---|---|
| 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 any help or just have a question, please get in touch with our support team at [email protected].
Updated 5 months ago