5. Get Invoice

Paylink Get Orders API enables the merchant's application to get specific invoices.

Overview

The merchant's application is responsible for calling this endpoint to check the payment status of the invoice using "TransactionNo." Then from the response, the merchant's application checks the invoice payment status from the field "orderStatus."

Important Note

🚧

Important Note for using getInvoice

Merchant's application must call the getInvoice endpoint immediately after the payment on the server side. First, check the integrity of the price by getting the amount paid "amount." and comparing it with the invoice amount, then check the payment status "orderStatus" to be "paid.".

Endpoint

GET /api/getInvoice/{transactionNo}

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer token.
Content-TypeYesIt must be set to application/JSON.

Response Body

The response to the request is as follows:

ParameterTypeDescription
gatewayOrderRequestObjectThe invoice details were sent to the gateway. See details below.
amountFloatThe total amount of the invoice.
transactionNoStringThe gateway assigns the transaction number.
orderStatusStringThe status of the invoice.
paymentErrorsStringAny payment errors that occurred.
urlStringThe URL to the payment page.
qrUrlStringThe URL to the QR code image for the payment
checkUrlStringThe URL of the API can be used to check the status of the price. NOTE: Calling this URL must have a token in the header.
successBooleanThis field indicates whether this endpoint operation is successful or not. NOTE: This is not the payment or order status. It is the endpoint for getting invoice details.
digitalOrderBooleanThis field indicates whether the order contains digital products or not.
foreignCurrencyRateFloatThis is about the foreign currency rate used in the transaction, if applicable. In addition, it includes the exchange rate related to the SAR currency.
paymentReceiptObjectAn object is displayed when the order is paid. It contains the following information:
- receiptUrl: The URL of the receipt.
- passcode: The passcode required to open the receipt.
- paymentMethod: The payment type, such as MADA, VISA, etc.
- paymentDate: The payment date.
- bankCardNumber: The last four digits of the card, if any.

Order Status Possible Values

orderStatus field can contain the following values:

ValueDescription
PendingThe invoice is still pending payment.
PaidThe customer successfully paid the invoice.
CanceledPaylink or the merchant compensated the invoice.

If the payment is declined, orderStatus is still pending payment until the Paylink system cancels it, but the paymentErrors field will contain the reason for the decline.

Payment error codes

The payment error code returned in the "paymentErrors" array of the following example object:

{
  	"errorCode":"05", //The code of the error.
  	"errorTitle":"Do Not Honor", //The title of the error
  	"errorMessage":"Do Not Honor", //The detail description message of the error
	"errorTime":"2020/10/25" //The time of the decline
}

The full possible values are as follows:

CodeTitleDescription
01Refer To Card IssuerThe issuer refuses the transaction
03Invalid Merchant NumberThis error indicates that the entered details are incorrect or your merchant facility is non-functional
04Pick Up CardThe transaction is declined by the issuing bank that requested to retain the card as it could be reported as lost or stolen
05Do not honourThe issuing bank is unwilling to accept the transaction
06ErrorError
12Invalid TransactionAn error occurred while processing the card
13Invalid AmountInvalid amount
14Invalid Card NumberThe card issuing bank has declined the transaction because of an incorrectly entered credit card number or a number that doesn't exist
15No IssuerThe customer's card issuer doesn't exist
22Suspected MalfunctionThe issuing bank is not responding during the transaction
30Format ErrorFormat error
31Bank Not Supported By SwitchThe customer's bank has declined the transaction because it doesn't allow using the card for mail/telephone, fax, email, or internet orders
34Suspected Fraud, Retain CardThe transaction is declined by the issuing bank as there is suspected fraud on this credit card number
37Contact Acquirer Security DepartmentThe customer's card issuer has declined the transaction and requested to retain your customer's card
41Lost CardThe issuing bank has declined the transaction as the owner of the card reported it as lost or stolen
42No Universal AccountThe issuing bank declines the transaction as the account type is not valid for this card number
43Stolen CardThe issuing bank has declined the transaction as the credit card owner has reported this card as stolen
49The Card Was DeclinedThe customer's card issuer has declined the transaction as the credit card is not enabled for online transactions
51Insufficient FundsThe transaction is denied by the issuing bank as there are not enough funds in the associated bank account to complete this payment, or the transaction will put the customer's credit card over the limit
54Expired CardThe card is expired and no longer valid to use
56No Card RecordThe issuer declines the transaction, as the credit card number does not exist
57Function Not Permitted To CardholderThe issuing bank has declined the transaction as this card cannot be used for this type of transaction
58Function Not Permitted To TerminalThe code appears when the card cannot be used for this type of transaction or when the merchant processing account is not correctly configured
59Suspected FraudThe issuer declined the transaction because it appeared fraudulent
61Withdrawal Limit ExceededThe issuer has declined the transaction because it will exceed the customer's card limit
62Restricted CardThe card is invalid in a specific region or country, or the customer tried to pay online with a card that does not support your online payments
67Capture CardThe issuing bank declined the transaction because the card is suspected to be counterfeit
91Card Issuer UnavailableThere was a problem contacting the issuing bank to authorize the transaction
92Unable To Route TransactionThe customer's card can't be found for routing, and the code is mainly used for a test credit card number.

Try the endpoint

For more detail about the endpoint and to try it out, please click here.