GetPaymentStatus

Endpoint

Overview

The "GetPaymentStatus" endpoint is a POST request. It is used to check the status of your invoice to assure that the payment has been done successfully or not. Detailed functionality of how to use this endpoint is explained in the Payment Inquiry section.

The endpoint on Swagger is: Payment_GetPaymentStatus.

Now, we are going to declare the endpoint and its models along with each accepted parameter and possible value.

📘

Request Header

Add "Authorization": "Bearer {Token}" to request header. Token of demo configuration can be found here.


Request Model

The request is a POST request with the following parameters:

Input ParameterTypeDescription
Key stringRefers to the invoice number or payment ID based on the key type
KeyType string"InvoiceId" Refers to the invoice number that is generated by MyFatoorah

"PaymentId" the value is returned upon having any update on the invoice payment

"CustomerReference" The reference used to link your orders in the store

👍

PaymentId

We strongly recommend to use the value PaymentId (which is returned in the CallBackURL ) to inquire the payment status, this will get you full information about the invoice that you can use within your application. As long as there is not payment or transactions done for a certain invoice, you can inquire using InvoiceId


Response Model

After viewing the Response Model that you will get as a result of your request, here, you will find full details about the Data Model of this API endpoint. Let's check it and its contents.

Response FieldTypeDescription
InvoiceId numberRepresents the invoice ID that was used in the inquiry call
InvoiceStatus string"Pending"
"Paid"
"Canceled"
InvoiceReference stringInvoice reference that is generated by MyFatoorah
CustomerReference stringThe customer reference data associated with the invoice
CreatedDate stringThe creation date of the invoice
ExpiryDate stringThe expiry date for the invoice
InvoiceValue numberInvoice total value with the actual base account currency
Comments stringComments that are associated with the invoice (mainly used portal use users)
CustomerName stringThe customer name that was save along with the invoice
CustomerMobile stringCustomer mobile number
CustomerEmail stringCustomer email address
UserDefinedField stringThe user defined filed that was stored during the invoice creation
InvoiceDisplayValue stringInvoice value that is displayed in case of different currency from the base one
DueDepositnumberThe amount that will be deposited to the vendor
DepositStatusstringThe deposit status of the invoice, if it is "Deposited" or "Not Deposited".
InvoiceItems Array of InvoiceItemModel objects
InvoiceTransactions Array of InvoiceTransactionModel objects

InvoiceItemModel

Response FieldTypeDescription
ItemName stringInvoice item name that is stored with the invoice
Quantity integerItem quantity
UnitPrice numberItem unit price
Weight number100 >= Weight > 0
Weight in kg
Width number200 >= Width > 0
Width in cm
Height number160 >= Height > 0
Height in cm
Depth number200 >= Depth > 0
Depth in cm

InvoiceTransactionModel

Response FieldTypeDescription
TransactionDate stringThe date of the transaction related to the invoice
PaymentGateway stringThe gateway the transaction was processed through
ReferenceId stringThe reference that is generated by the payment gateway
TrackId stringThe track number that is used to track the transaction with the gateway
TransactionId stringThe transaction ID
PaymentId stringThe payment ID that is assigned to this transaction
AuthorizationId stringThe authorization ID that is assigned to this transaction
TransactionStatus stringThe status of the transaction as
InProgress
Succss
Failed
Canceled
Authorize
TransationValue stringThe value of the transaction
CustomerServiceCharge stringThe service charges considered on the customer during the transaction
TotalServiceChargestringTotal service charge deducted from MyFatoorah side
DueValue stringThe amount value of this transaction
PaidCurrency stringThe currency that was used to pay the transaction
PaidCurrencyValue stringThe currency value that was used to pay the transaction
VatAmountfloatThe value of the VAT amount for the transaction
Currency stringTransaction currency
Error stringThe error message that might be associated with the transaction.
This error is from the acquirer bank / platform
ErrorCode stringThe MyFatoorah error code. Kindly, refer to the Error Codes table.

📘

Transactions

Transactions information are totally related to the gateway response that came from the acquirer bank / platform. Not necessarily to have information to all the fields, and this was designed only to provide you information about all transactions that happened for a certain invoice

Error Codes

CodeExplanation
MF0013DS authentication failed, possible reasons (user inserted a wrong password, cardholder/card issuer are not enrolled with 3DS, or the issuer bank has technical issue).
MF002The issuer bank has declined the transaction, possible reasons (invalid card details, insufficient funds, denied by risk, the card is expired/held, or card is not enabled for online purchase).
MF003The transaction has been blocked from the gateway, possible reasons (unsupported card BIN, fraud detection, or security blocking rules).
MF004Insufficient funds
MF005Session timeout
MF006Transaction canceled
MF007The card is expired.
MF008The card issuer doesn't respond.
MF009Denied by Risk
MF010Wrong Security Code
MF020Unspecified Failure

Sample Message

Now, you can get all the information about the invoice transactions and suppliers - if exist - and the deposit amount of each supplier.

{
  "Key": "2725229",
  "KeyType": "InvoiceId"
}
{
  "IsSuccess": true,
  "Message": "",
  "ValidationErrors": null,
  "Data": {
    "InvoiceId": 2725229,
    "InvoiceStatus": "Paid",
    "InvoiceReference": "2023009517",
    "CustomerReference": "",
    "CreatedDate": "2023-09-14T13:49:17.623",
    "ExpiryDate": "September 24, 2023",
    "ExpiryTime": "13:49:17.623",
    "InvoiceValue": 250,
    "Comments": "",
    "CustomerName": "MyFatoorah",
    "CustomerMobile": null,
    "CustomerEmail": "[email protected]",
    "UserDefinedField": null,
    "InvoiceDisplayValue": "0.000 KD",
    "DueDeposit": 249.25,
    "DepositStatus": "Not Deposited",
    "InvoiceItems": [],
    "InvoiceTransactions": [
      {
        "TransactionDate": "2023-09-14T13:49:49.8333333",
        "PaymentGateway": "KNET",
        "ReferenceId": "325710000447",
        "TrackId": "14-09-2023_1702585",
        "TransactionId": "325710007573919",
        "PaymentId": "100325710000064334",
        "AuthorizationId": "B89997",
        "TransactionStatus": "Succss",
        "TransationValue": "250.000",
        "CustomerServiceCharge": "5.000",
        "TotalServiceCharge": "5.000",
        "DueValue": "255.000",
        "PaidCurrency": "KD",
        "PaidCurrencyValue": "255.000",
        "VatAmount": "0.750",
        "IpAddress": "197.58.83.203",
        "Country": "Egypt",
        "Currency": "KD",
        "Error": null,
        "CardNumber": null,
        "ErrorCode": ""
      }
    ],
    "Suppliers": []
  }
}
{
  "IsSuccess": true,
  "Message": "",
  "ValidationErrors": null,
  "Data": {
    "InvoiceId": 2817877,
    "InvoiceStatus": "Paid",
    "InvoiceReference": "2023016636",
    "CustomerReference": null,
    "CreatedDate": "2023-10-04T14:40:56.723",
    "ExpiryDate": "February 1, 2024",
    "ExpiryTime": "14:40:56.723",
    "InvoiceValue": 200,
    "Comments": null,
    "CustomerName": "Anonymous",
    "CustomerMobile": "+965",
    "CustomerEmail": null,
    "UserDefinedField": null,
    "InvoiceDisplayValue": "200.000 KD",
    "DueDeposit": 104.894,
    "DepositStatus": "Not Deposited",
    "InvoiceItems": [],
    "InvoiceTransactions": [
      {
        "TransactionDate": "2023-10-04T14:41:44.65",
        "PaymentGateway": "VISA/MASTER",
        "ReferenceId": "327711284480",
        "TrackId": "04-10-2023_1722745",
        "TransactionId": "284480",
        "PaymentId": "07072817877172274574",
        "AuthorizationId": "243320",
        "TransactionStatus": "Succss",
        "TransationValue": "200.000",
        "CustomerServiceCharge": "0.000",
        "TotalServiceCharge": "4.440",
        "DueValue": "200.000",
        "PaidCurrency": "KD",
        "PaidCurrencyValue": "200.000",
        "VatAmount": "0.666",
        "IpAddress": "41.35.104.74",
        "Country": "Egypt",
        "Currency": "KD",
        "Error": null,
        "CardNumber": "545454xxxxxx5454",
        "ErrorCode": ""
      }
    ],
    "Suppliers": [
      {
        "SupplierCode": 1,
        "SupplierName": "Khaled",
        "InvoiceShare": 200,
        "ProposedShare": 90,
        "DepositShare": 90
      }
    ]
  }
}