post https://dev-apiv2api.upayments.com/api/v1/charge
It will return payment link
Overview
Overview
Request Header
Add "Authorization": "Bearer {Token}" to the request header.
Request Model
The request is a POST request with the following parameters:
Input Parameter | Type | Length | Description |
---|---|---|---|
products | array, optional | ||
products. name | string, optional | 255 | Pass product name here |
products.description | string, optional | 255 | Pass product description here |
products.price | float, optional | 7 | Pass product price here |
products.quantity | integer, optional | 7 | Pass quantity here |
order | array, mandatory | ||
order.id | string, mandatory | 50 | Refers to the order or transaction ID in your system that you have sent in the request earlier |
order.reference | string, optional | 255 | Refers to the order or transaction ID in your system that you have sent in the request earlier |
order.description | string, mandatory | 500 | Refers to the order description |
order.currency | string, mandatory | 3 | |
order.amount | float, mandatory | 22 | The amount you are seeking to charge the customer accepts decimal values e.g. 2.50. |
paymentGateway | array, (Mandatory if you are White label user) | ||
paymentGateway.src | string, (Mandatory if you are White label user) | 11 (maximum) | You need to pass payment source here like knet, cc, samsung-pay, apple-pay, google-pay and create-invoice |
notificationType | string, (Mandatory if using the above paymentGateway.src = create-invoice) | 5 (maximum) | • email - send the invoice link by email only. You should provide the customer.email. • sms - send the invoice link by SMS only. You should provide the customer.mobile. • link - returns only the invoice URL through the response. • all - send the invoice link by both email and SMS, you have to provide all the needed parameters. |
language | string, mandatory | 2 | EN to display the checkout page in English AR to display the checkout page in Arabic |
tokens | array, mandatory | ||
tokens.customerUniqueToken | integer, optional | 8 (minimum) | Pass customer unique token here. you will get saved card on payment page. |
reference | array, mandatory | ||
reference.id | string, mandatory | 150 | Refers to the order or transaction ID in your own system we will save your ID for our reference. |
customer | array, mandatory | ||
customer.uniqueId | string, mandatory | 150 | Pass customer unique ID for our reference |
customer.name | string, mandatory | 50 | Pass customer name for our reference |
customer.email | string, mandatory | 50 | Pass customer email address here. If notificationType = email customer will receive the payment receipt on this email address. |
customer.mobile | string, mandatory | 15 | Pass customer phone number here. If notificationType.mobile is true customer will receive the payment sms on this mobile number. |
customerExtraData | string, optional | We can pass any User Define Data (UDF) here | |
extraMerchantData | array, optional | ||
extraMerchantData.amount | float, optional | 10 | Pass merchant transaction amount. |
extraMerchantData.knetCharge | float, optional | 2,2 | Merchant’s Knet charge rate for the vendor. Define your fees here which means it's your commission from each transaction. |
extraMerchantData.knetChargeType | string, optional | 10 | Knet charge type (fixed or percentage) |
extraMerchantData.ccCharge | float, optional | 2,2 | Merchant’s Credit Card charge rate for the vendor. Define your fees here which means it's your commission from each transaction. Includes MasterCard, Visa, Samsung Pay, Google Pay, Apple Pay, and Amex. |
extraMerchantData.ccChargeType | string, optional | 10 | CreditCard charge type (fixed or percentage) |
extraMerchantData.ibanNumber | string, optional | 25 | Pass merchant IBAN Number. |
returnUrl | string, mandatory | 250 | The return URL you like to have the successful payment |
cancelUrl | string, mandatory | 250 | The cancel URL you like to have the cancel or failure payment |
notificationUrl | string, mandatory | 250 | The notification URL will receive the webhook data |
plugin | array, optional | ||
plugin.src | string, optional | 11 | Supported plugin opencart,whmcs,cscart,woocommerce,magento,ecwid,android-sdk,ios-sdk and flutter-sdk |
{
"products": [
{
"name": "Logitech K380",
"description": "Logitech K380 / Easy-Switch for Upto 3 Devices, Slim Bluetooth Tablet Keyboard ",
"price": 10,
"quantity": 1
},
{
"name": "Logitech M171 Wireless Optical Mouse",
"description": "Logitech M171 Wireless Optical Mouse (2.4GHz Wireless, Blue Grey)",
"price": 10,
"quantity": 1
}
],
"order": {
"id": "202210101255255144669",
"reference": "11111991",
"description": "Purchase order received for Logitech K380 Keyboard",
"currency": "KWD",
"amount": 20
},
"language": "en",
"paymentGateway": {
"src": "knet"
},
"tokens": {
"customerUniqueToken": 90908986
},
"reference": {
"id": "202210101202210101"
},
"customer": {
"uniqueId": "2129879kjbljg767881",
"name": "Jhon Smith",
"email": "[email protected]",
"mobile": "+96512345678"
},
"returnUrl": "https://success.com",
"cancelUrl": "https://error.com",
"notificationUrl": "https://callback.com"
}
{
"products": [
{
"name": "Logitech K380",
"description": "Logitech K380 / Easy-Switch for Upto 3 Devices, Slim Bluetooth Tablet Keyboard ",
"price": 10,
"quantity": 1
},
{
"name": "Logitech M171 Wireless Optical Mouse",
"description": "Logitech M171 Wireless Optical Mouse (2.4GHz Wireless, Blue Grey)",
"price": 10,
"quantity": 1
}
],
"order": {
"id": "202210101255255144669",
"reference": "11111991",
"description": "Purchase order received for Logitech K380 Keyboard",
"currency": "KWD",
"amount": 20
},
"language": "en",
"reference": {
"id": "202210101202210101"
},
"customer": {
"uniqueId": "2129879kjbljg767881",
"name": "Jhon Smith",
"email": "[email protected]",
"mobile": "+96512345678"
},
"returnUrl": "https://success.com",
"cancelUrl": "https://error.com",
"notificationUrl": "https://callback.com"
}
{
"products": [
{
"name": "Logitech K380",
"description": "Logitech K380 / Easy-Switch for Upto 3 Devices, Slim Bluetooth Tablet Keyboar ",
"price": 10,
"quantity": 1
},
{
"name": "Logitech M171 Wireless Optical Mouse",
"description": "Logitech M171 Wireless Optical Mouse (2.4GHz Wireless, Blue Grey)",
"price": 10,
"quantity": 1
}
],
"order": {
"id": "202210101255255144669",
"reference": "11111991",
"description": "Purchase order received for Logitech K380 Keyboard",
"currency": "KWD",
"amount": 20
},
"paymentGateway": {
"src": "knet"
},
"language": "en",
"tokens": {
"customerUniqueToken": 90908986
},
"reference": {
"id": "202210101202210101"
},
"customer": {
"uniqueId": "2129879kjbljg767881",
"name": "Jhon Smith",
"email": "[email protected]",
"mobile": "+96512345678"
},
"returnUrl": "https://upayments.com/en/",
"cancelUrl": "https://developers.upayments.com/",
"notificationUrl": "https://webhook.site/92eb6888-362b-4874-840f-3fff620f7cf4",
"extraMerchantData": [
{
"amount": 10,
"knetCharge": 5,
"knetChargeType": "fixed",
"ccCharge": 10,
"ccChargeType": "percentage",
"ibanNumber": "KW91KFHO0000000000051010173254"
},
{
"amount": 10,
"knetCharge": 5,
"knetChargeType": "fixed",
"ccCharge": 7,
"ccChargeType": "percentage",
"ibanNumber": "KW31NBOK0000000000002010177457"
}
]
}
Response Model
{
"status": true,
"message": "Payment link generated successfully",
"data": {
"link": "https://kpaytest.com.kw/kpg/PaymentHTTP.htm?param=paymentInit&trandata=0c399ba69806a53e095952a7ca7ce1dc1f9abc35a06a5afd00ba8b941b48086da33836564d9c731427e89b4291d3f5826acdbaed91d529e1f04d4edd6d269a4f66509b05d0bb3dde9bf0a453ed2db7197234ae776aac3e5c212c0038f46f94f6ad32f73fbc219c396da9d0dfe0552437417928756222a0403b46774549ac3a6aecb41495e7490b28fc11adb13c8f044a8dbd68600b60331283b6ce3b7786fbc23c97851bda86b55aa91be155d330d368a7b8506ceab47988a9fea091ea8f73c2d61a72e237cedbb553c01a4183e40fd2fe5deb22ad3c39c5355366e1b7d1b4a6241c9917f42bff1c7638b13b9a442124ef514957513abd680ad4395526b0fb106a748d304b8883e3fea5ea30a0f5e70a6298bec8cc304a3aefc315c48d806bac&tranportalId=252501&responseURL=http://localhost:8000/get-knet-success-response&errorURL=http://localhost:8000/get-knet-error-response",
"trackId": "20220647592811619337331833645"
}
}
{
"status": true,
"message": "You are not white label user. To enable please contact to support",
"data": {
"link": "https://dev-apiv2api.upayments.com/?session_id=20230537070305505128902825657127217521553614135"
}
}
{
"status": true,
"message": "You are not white label user. To enable please contact to support",
"data": {
"link": "https://dev-apiv2api.upayments.com/?session_id=20230537070305505128902825657127217521553614135"
}
}