Pay By Link (E-Invoice) - Using our APIS
if you already have your own dashboard and you want to generate e-invoices for your clients , you can login to fawry and generat e-invoices using our APIS
Get Invoice Details API
get all details about an invoice using Invoice Details API.
In case you are still in development phase, you will need to call our API using Get at the following staging endpoint API point URL
Meanwhile, whenever you are ready for production, you should use the following production API endpoint URL instead
Sample API Calls
An example call of Invoice Details API is given below.
// Use fetch to send request data to FawryPay Invoice Details API.
// https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
const response = await fetch('https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details', {
method: 'Get',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + transaction_data.token, // The token you obtained from the login API
}
}
);
// Return and display the result of the charge.
return response.json();
}
$response =request('Get', 'https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details', [
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer ' + $token, // The token you obtained from the login API
]
] , true)
]);
$response = json_decode($response->GetBody()->GetContents(), true);
$invoiceDetailsData = $response['type']; // Get response values
# importing the requests library
import requests
# importing Hash Library
import hashlib
# FawryPay invoices details API Endpoint
URL = "https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details"
# sending Get request and saving the response as response object
invoice_details_request = requests.Get(url = URL,
headers={'Content-Type':'application/json',
'Authorization': 'Bearer {}'.AccessToken}//The token you obtained from the login API
)
# extracting data in json format
status_response = status_request.json()
function invoice_details() {
axios.Get('https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details',
headers: {
'Authorization': `Bearer AccessToken` //The token you obtained from the login API
}
)
.then(response => {
// Get Response Contents
let invoiceDetailsData = response.data.invoiceDetailsData;
//
})
.catch(error => {
console.log(error.response.data)
})
}
$ curl https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details\
-H "content-type: application/json , Authorization: Bearer ACCESS_TOKEN" \
-X Get \
URL url = new URL ("https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("Get");
con.setRequestProperty("Content-Type", "application/json; utf-8");
con.setRequestproperty("Authorization","Bearer " + AccessToken); //The token you obtained from the login API
con.setRequestProperty("Accept", "application/json");
con.setDoOutput(true);
try(BufferedReader br = new BufferedReader(
new InputStreamReader(con.GetInputStream(), "utf-8"))) {
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null) {
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using Newtonsoft.Json;
namespace FawryPayRequest
{
public class Program
{
static void Main(string[] args)
{
GetJson("https://atfawry.fawrystaging.com/invoice-api/invoices/{invoice_num}/details");
}
private static void GetJson(string uri, invoice_details_request GetParameters)
{
string GetData = JsonConvert.SerializeObject(GetParameters);
byte[] bytes = Encoding.UTF8.GetBytes(GetData);
var httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
httpWebRequest.Method = "Get";
httpWebRequest.ContentLength = bytes.Length;
httpWebRequest.Headers.Add("Authorization", "Bearer " + AccessToken);//The token you obtained from the login API
httpWebRequest.ContentType = "text/json";
using (Stream requestStream = httpWebRequest.GetRequestStream())
{
requestStream.Write(bytes, 0, bytes.Count());
}
var httpWebResponse = (HttpWebResponse) httpWebRequest.GetResponse();
if (httpWebResponse.StatusCode != HttpStatusCode.OK)
{
string message = String.Format("Get failed. Received HTTP {0}", httpWebResponse.StatusCode);
throw new ApplicationException(message);
}
}
}
}
Response Parameters
FawryPay Sample Response
Whenever you call FawryPay Invoices Details API, you may expect a response in the form of JSON object which contains all the Invoice Details.
Sample Invoices Details API Response
Response Parameters Description
Parameter | type | Description | example | |
---|---|---|---|---|
id | integer |
ID of the invoice. | 1857 | |
dueDate | String |
Due data of the invoice. | 2021-02-27 | |
expiryDate | String |
Expiration date. | 2021-03-17T20:52:06 | |
releaseDate | String |
If merchant want to issue invoice with different date rather than sending date. | 2021-02-27T20:51:55.147 | |
creationDate | String |
the creation date of invoice – date (ISO format). | 2021-02-27 | |
amount | double |
payment due amount of invoice. | 225.45 | |
subTotal | double |
items amount. | 281.5 | |
discount | double |
total discount on invoice, (type , value). | 25.05 | |
taxes | double |
total taxes on invoice, (type , value). | 0 | |
paymentStatus | ||||
id | integer |
ID of the payment status. | 8 | |
code | double |
Code of the payment status. | CANCELED | |
nameEn | String |
Name of the payment status in English. | Canceled | |
nameAr | String |
Name of the payment status in Arabic. | ملغي | customer |
name | String |
Name of the customer. | samir ghoniem | |
mobile | String |
Mobile of the customer. | 01234567899 | |
String |
E-mail of the customer. | samir.ghoniem@fawry.com | ||
number | double |
number of the invoice. | 4828660 | |
data | ||||
id | integer |
This is the id of the data. | 1836 | |
type | String |
This is the type of invoice. | RECURRING | |
firstDueDate | String |
This is the due date of invoice. | 2021-02-27 | |
creationDate | String |
the creation date of invoice – date (ISO format). | 2021-02-27 | |
cycleType | String |
Values: "MONTH" or “WEEK”. | MONTH | |
cycleValue | double |
Minimum 1. | 2 | |
paymentType | String |
optional (default is PUSH_TO_CUSTOMER). | • PUSH_TO_CUSTOMER: customer will receive SMS contains link to pay invoice through it. • PUSH_TO_FAWRY_PAY: customer will receive SMS contains order reference number and can pay it through fawry retails. |
|
status | String |
in case of recurring invoice this status will differ than the invoice status itself . | • “NOT_STARTED” which mean customer not paid the invoice or not start paying any one of the recurring invoices • “IN_PROGRESS” customer currently pay the single invoice or the first due invoice in case of recurring. • “PAID” the customer paid the single invoice or all invoices in case of recurring. • “EXPIRED” the single invoice expired or the whole invoices of recurring |
|
alertMerchantUponExpiry | Boolean |
In case merchant need to receive email once invoice expired, optional (default is false). | false | |
merchantName | String |
Name of the merchant. | samir | |
merchantLogo | String |
Logo of the merchant. | 400000004703/merchant-logo/merchant-logo.png | |
merchantAccountNumber | String |
Number of the merchant account. | siYxylRjSPxYSRdIGnHsCg== | |
preferredPaymentMethod | String |
Method to pay. | CARD. | |
items | ||||
itemCode | String |
code of the item. | 1cf4fc51ba984471ac3a063dfd7c6f4f | |
purchasedQuantity | integer |
Quantity of the purchased items. | 1 | |
price | double |
item price. | 250.5 | |
variantCode | String |
variant code of the item. | null | |
discount | String |
optional – JSON object containing "value" and "type" of the discount. | "type": null, "value": null | |
nameAr | String |
Name of the item in Arabic. | description 1 | |
nameEn | String |
Name of the item in English. | description 1 | |
imageUrl | String |
Image url of the item. | null | |
businessReference | double |
order reference number. | 123456 | |
order | String |
In case invoice paid or under payment an order attached to invoice with the given details. | null | |
paymentUrl | String |
URL of the payment. | https://atfawry/atfawry/invoice/pay/4776211 | |
template | ||||
primaryColor | String |
Primary color of the template. | #6C63FF | |
secondaryColor | String |
Secondary color of the template. | #006C98 | |
smsTemplateEn | String |
sms template in English. | click ${INVOICE_LINK} to pay your invoice Total Amt Due ${invoice.amount} EGP, must paid before ${invoice.expiryDate}. | |
smsTemplateAr | String |
sms template in Arabic. | اضغط هنا ${INVOICE_LINK} لدفع فاتورتك، إجمالي الفاتورة ${invoice.amount} ج.م تنتهي في ${invoice.expiryDate}. | |
backgroundColor | String |
Background color of the template. | .#F1F5F9 | |
fontColor | String |
Font color of the template. | #3D4254 | |
invoiceTemplateCode | String |
Code of the tmplate. | template-one |
Gethttps://atfawry.fawrystaging.com/invoice-api/{invoice_num}//{invoice_num}/details
// please run login API and put your token in the token field below
Response
// API Response Data Should Appear here
// This is a sample successful Response
{
"id": 1857,
"dueDate": "2021-02-27",
"expiryDate": "2021-03-17T20:52:06",
"releaseDate": "2021-02-27T20:51:55.147",
"creationDate": "2021-02-27",
"amount": 225.45,
"subTotal": 250.5,
"discount": 25.05,
"taxes": 0,
"paymentStatus": {
"id": 8,
"code": "CANCELED",
"nameEn": "Canceled",
"nameAr": "ملغي"
},
"customer": {
"name": "samir ghoniem",
"mobile": "01234567899",
"email": "samir.ghoniem@fawry.com"
},
"number": "4828660",
"data": {
"id": 1836,
"type": "RECURRING",
"firstDueDate": "2021-02-27",
"creationDate": "2021-02-27",
"cycleType": "MONTH",
"cycleValue": 2,
"paymentType": "PUSH_TO_CUSTOMER",
"status": "NOT_STARTED",
"items": [
{
"itemCode": "1cf4fc51ba984471ac3a063dfd7c6f4f",
"purchasedQuantity": 1,
"price": 250.5,
"variantCode": null,
"discount": {
"type": null,
"value": null
},
"nameAr": "description 1",
"nameEn": "description 1",
"imageUrl": null
}
],
"alertMerchantUponExpiry": false,
"merchantName": "samir",
"merchantLogo": "400000004703/merchant-logo/merchant-logo.png",
"merchantAccountNumber": "siYxylRjSPxYSRdIGnHsCg==",
"preferredPaymentMethod": "CARD"
},
"businessReference": "123456",
"order": null,
"paymentUrl": "https://atfawry/atfawry/invoice/pay/4776211",
"template": {
"primaryColor": "#6C63FF",
"secondaryColor": "#006C98",
"smsTemplateEn": "click ${INVOICE_LINK} to pay your invoice Total Amt Due ${invoice.amount} EGP, must paid before ${invoice.expiryDate}",
"smsTemplateAr": "اضغط هنا ${INVOICE_LINK} لدفع فاتورتك، إجمالي الفاتورة ${invoice.amount} ج.م تنتهي في ${invoice.expiryDate}",
"backgroundColor": "#F1F5F9",
"fontColor": "#3D4254",
"invoiceTemplateCode": "template-one"
}
}
Was this page helpful?
Thank you for helping improve FawryPay's documentation. If you need help or have any questions, please consider contacting support.