Create UPay invoices from an external platform
Request Header
Add "Authorization": "Bearer {Token}" to the request header.
Using the create payment request API, you can create UPay invoices from your application (which could include an ERP, ecommerce or any other external platform) and send them as a payment link to your end customers and card holders.
Required input parameters in [create payment request](
paymentGateway.src
= create-invoicenotificationType
= email/sms/link (mandatory)
Note:
The
invoice_id
received in the response can be passed with get-payment-status API to fetch the transaction details of the respective invoice
- This feature does not work when ExtraMerchantsData has any value
notificationType
is mandatory while using this feature
Note
Emails, Whatsapp messages and SMS will be sent only on Production environment
Request Model
The request is a POST request with the following parameters:
Input Parameter | Type | Length | Description |
---|---|---|---|
products | object, 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 | object, 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 | object, 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 | object, 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 | object | ||
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 | object, 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 | object, 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": "email",
"language": "en",
"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://uinvoice.upayments.com/BLgeyee79D",
"invoice_id": "BLgeyee79D"
}
}