Create UPay invoices from an external platform
Request Header
Add "Authorization": "Bearer {Token}" to the request header.
This API can be used to create UPay invoices from your software which could include an ERP, ecommerce or any other external platform.
- create_invoice will require the following details:
- paymentGateway.src = create-invoice
- notificationType = email/sms/link
- This feature does not work when ExtraMerchantsData has any value.
- notifyUrl should be mandatory field for this feature
notification and notifyUrl field is required while calling create_invoice field Contact us at [email protected] to enable this feature.
Request Model
The request is a POST request with the following parameters:
Input Parameter | Type | Length | Description |
---|---|---|---|
products | array, optional | ||
products. name | string, optional | Pass product name here | |
products.description | string, optional | Pass product description here | |
products.price | float, optional | Pass product price here | |
products.quantity | integer, optional | 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 | Pass order currency here |
order.amount | float, mandatory | 22 | The amount you are seeking to charge the customer accepts decimal values e.g. 2.50. |
paymentGateway | array, mandatory | ||
paymentGateway.src | string, mandatory | 11 (maximum) | You need to pass payment source here like create-invoice |
notificationType | string, mandatory | 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 |
isSaveCard | boolean, mandatory | 1 | "true" or "false" to indicate if the customer wants to save the card or not |
tokens | array, mandatory | ||
tokens.creditCard | string, optional | 25 | Pass the credit card token. |
tokens.customerUniqueToken | integer, optional | 8 (minimum) | Pass customer unique token here. you will get saved card on payment page. |
reference | array | ||
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 | number, mandatory | 10 | Pass customer phone number here. If notificationType = mobile customer will receive the payment sms on this mobile 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,opencart,woocommerce,magento,ecwid |
{
"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
},
"paymentGateway": {
"src": "create-invoice"
},
"notificationType": "all",
"language": "en",
"isSaveCard": false,
"tokens": {
"creditCard": null,
"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"
}
{
"status": true,
"message": "Data received successfully",
"data": {
"sms": true,
"email": true,
"link": true,
"url": "https://preprod-upay.upayments.com/merchant_invoice/78XAnbpJVP1"
}
}