Skip to main content
Version: v2.0.4 latest

Create Payment

Creates a Payment and returns the Payment object including formUrl (a payment link).

API Endpoint:

POST https://uat-sandbox-3ds-api.qi.iq/api/v1/payment

Headers

NameTypeDescriptionRequired
X-Terminal-IdStringThe ID of the Merchant Terminal. Provided by the Acquirer.Yes

CURL Example

curl --location '<API_HOST>/api/v1/payment' \
--header 'X-Terminal-Id: {terminalId}' \
--header 'Authorization: Basic <Base64<username:password>>' \
--data '{
"requestId": <GUID>,
"amount": 1000.00,
"locale": "en_US",
"currency": "IQD",
"finishPaymentUrl": "https://www.merchant.com/finish",
"notificationUrl": "https://www.merchant.com/webhook-notification"
}'

Request Body

Media type: application/json

Example of a request body:

{
"requestId": "37b85e60-e7a6-4abb-9466-703472fb83b9",
"amount": 256.505,
"currency": "IQD",
"locale": "en_US",
"finishPaymentUrl": "https://merchant.net/finish",
"notificationUrl": "https://merchhant.net/notification",
"customerInfo": {
"firstName": "John",
"middleName": "Mark",
"lastName": "Doe",
"phone": "009647xxxxxxxxx",
"email": "j.doe@gmail.com",
"accountId": "j.doe",
"accountNumber": "40817123456787852369",
"address": "57th street 26",
"city": "Baghdad"
},
"additionalInfo": {
"key1": "value1",
"key2": "value2"
},
"appChannel": false // false for web payments, true when performing mobile payments!
}

Request body fields

FieldTypeDescription
requestIdstring requiredA unique identifier generated by the Merchant's side. It must be ensured that the RequestId remains unique within the context of each Merchant Terminal to prevent duplication or conflicts.
amountnumber required Specifies the total payment amount, including any applicable fees or commissions from the merchant. This field is required for all payment transactions but should be absent for non-payment transactions. Note non-payment transactions are used to collect card information without processing any payment. This type of transaction is useful when card details are needed for future use, but no immediate charge is required.
currencystring requiredThe ISO 4217 code represents the currency for the payment, for example: IQD - Iraqi Dinar, The value must be exactly 3 characters long, Max value = 3, Min value = 3
localestring optionalThe locale for the payment form. If not specified, the default locale for the Merchant Terminal will be used..
feesnumber optionalMerchant Fees, must have two decimels after point .
finishPaymentUrlstring requiredThis field specifies the URL where the payer will be redirected after the payment process is completed. The redirection occurs on the client side, and the URL is provided by the merchant. Once the payment is processed, the user is automatically sent to this URL, reflecting the outcome of the transaction, A merchant can use this field to redirect his user back to the merchant side, Maximum characters: 1024
notificationUrlstring required This field is used to provide a webhook URL where the payment gateway will send a POST request to notify the merchant's side of the payment status after the payer completes the transaction. The notification will include in its body the updated data object of the payment (containing the new status: success, pending, or failure), allowing the merchant to track the result of the payment in real time
customerInfoobject optionalThis object contains details about the customer making the payment and is optional for the merchant's side to include when using the create payment request. It helps the merchant track which customer is paying, offering visibility into their payments.
browserInfoobject optional This field contains details about the browser where the payment is being made, provided by the merchant's side. While this field is optional, if included, certain fields within the browserInfo object are mandatory. When including this object in body request, if any of required fields are missing, the payment gateway will return a “bad request” response.
additionalInfoobject optionalAdditional information about the payment.
appChannelboolean optionalA boolean value indicate if the payment is being made in app channel or not, the default value is false, When set to true the mobile payment channel will be enabled.

Response Details

200 OK Response

when create payment succeed, you will receive the following payment object:

{
"requestId": "4256ab83-de74-450f-b442-8fb995458243",
"paymentId": "f2bb43a8-488a-4281-977b-5b3418fc3c67",
"status": "CREATED",
"canceled": false,
"amount": 256.89,
"currency": "IQD",
"creationDate": "2024-08-04T15:34:33Z",
"formUrl": "https://uat-sandbox-3ds-api.qi.iq/api/v1/payment/f2bb43a8-488a-4281-977b-5b3418fc3c67",
"additionalInfo": {
"key1": "value1",
"key2": "value2"
}
}

200 OK Response fields

OptionsTypeDescription
requestIdstringA unique identifier generated by the Merchant's side. It must be ensured that the RequestId remains unique within the context of each Merchant Terminal to prevent duplication or conflicts.
paymentIdstringPayment ID (Transaction ID): the payment transaction reference ID in the Payment Gateway system
statusstringthe payment transaction status value, possible values are: SUCCESS, FAILED, CREATED & AUTHENTICATION_FAILED
canceledbooleanA boolean value indicate if the payment got canceled or not.
amountnumber Specifies the total payment amount, including any applicable fees or commissions from the merchant. This field is required for all payment transactions but should be absent for non-payment transactions. Note non-payment transactions are used to collect card information without processing any payment. This type of transaction is useful when card details are needed for future use, but no immediate charge is required.
currencystringThe ISO 4217 code represents the currency for the payment, for example: IQD - Iraqi Dinar, The value must be exactly 3 characters long, Max value = 3, Min value = 3
creationDatestringPayment object creation date, follows the ISO 8601 standard, example: '2024-08-04T15:34:33Z'.
formUrlstringThis object contains details about the customer making the payment and is optional for the merchant's side to include when using the create payment request. It helps the merchant track which customer is paying, offering visibility into their payments.
additionalInfoobjectAdditional information about the payment.

400 Bad Request

{
"error": {
"code": 27,
"description": "Authentication required: Incorrect credentials"
}
}

500 Server Error

{
"error": {
"code": 23,
"description": "INTERNAL_SYSTEM_ERROR"
}
}

Possible Error Codes

When a request fails, the response's error object contains the numeric code and its description. Use the code for programmatic handling and the name for logging.

CodeError nameDescription
1ORDER_ALREADY_EXISTSAn order with the same identifier already exists.
2ORDER_NOT_FOUNDNo order was found for the supplied identifier.
3ORDER_ALREADY_CANCELLEDThe order has already been cancelled.
4NO_COMPATIBLE_SERVICES_FOUNDNo service compatible with the request could be found.
5CAN_NOT_PROCESS_REQUESTThe request could not be processed.
6REQUISITES_NOT_FOUNDThe requested requisites do not exist.
7REQUISITES_ALREADY_EXISTSRequisites with the same details already exist.
8CAN_NOT_CREATE_NEW_REQUISITESNew requisites could not be created.
9TERMINAL_NOT_FOUND_EXCEPTIONThe specified terminal (X-Terminal-Id) was not found.
10PAYMENT_ALREADY_EXISTSA payment with the same identifier already exists.
11MAX_NUMBER_OF_PAYMENTS_FOR_ORDER_EXCEEDEDThe order has reached its maximum number of payments.
12PAYMENT_NOT_FOUNDNo payment was found for the supplied identifier.
13UNKNOWN_STRATEGYThe requested processing strategy is not recognized.
14PROCESSING_IMPOSSIBLEThe payment cannot be processed in its current state.
15CAN_NOT_CANCEL_PAYMENTThe payment cannot be cancelled.
16CAN_NOT_CONFIRM_PAYMENTThe payment cannot be confirmed.
17CAN_NOT_FINISH_AUTHENTICATIONAuthentication (3DS) could not be completed.
18REFUNDS_NOT_ALLOWEDRefunds are not allowed for this payment.
19PAYMENT_PARAMS_NOT_FOUNDThe required payment parameters were not found.
20REFUND_ERRORAn error occurred while processing the refund.
21VALIDATION_ERROROne or more request fields failed validation.
22INCORRECT_PAYMENT_STATEThe payment is not in a valid state for this operation.
23INTERNAL_SYSTEM_ERRORAn unexpected internal error occurred.
24EXTERNAL_SYSTEM_ERRORAn error was returned by an external system.
26INVALID_PAYMENT_FORM_DOMAINThe payment form domain is invalid.
27BAD_CREDENTIALSThe supplied authentication credentials are invalid.
28LIMIT_VIOLATIONThe operation exceeds a configured limit.
29TRANSFER_NOT_FOUNDNo transfer was found for the supplied identifier.
30INCORRECT_TRANSFER_STATEThe transfer is not in a valid state for this operation.
31TOKEN_NOT_FOUNDThe specified payment token does not exist.
32TOKEN_PROCESS_NOT_ALLOWEDThe requested operation is not allowed for this token.
33CAN_NOT_CANCEL_TRANSFERThe transfer cannot be cancelled.
34TRANSFER_ALREADY_EXISTSA transfer with the same identifier already exists.
35INVALID_TOKEN_TYPEThe supplied token type is invalid.
note

The full, canonical list of gateway error codes is maintained on the API Error Codes page. Code 25 is not currently in use.