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 ParameterTypeLengthDescription
productsarray, optional
products. namestring, optionalPass product name here
products.descriptionstring, optionalPass product description here
products.pricefloat, optionalPass product price here
products.quantityinteger, optionalPass quantity here
orderarray, mandatory
order.idstring, mandatory50Refers to the order or transaction ID in your system that you have sent in the request earlier
order.referencestring, optional255Refers to the order or transaction ID in your system that you have sent in the request earlier
order.descriptionstring, mandatory500Refers to the order description
order.currencystring, mandatory3Pass order currency here
order.amountfloat, mandatory22The amount you are seeking to charge the customer accepts decimal values e.g. 2.50.
paymentGatewayarray, mandatory
paymentGateway.srcstring, mandatory11 (maximum)You need to pass payment source here like create-invoice
notificationTypestring, mandatory5 (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.
languagestring, mandatory2EN to display the checkout page in English
AR to display the checkout page in Arabic
isSaveCardboolean, mandatory1"true" or "false" to indicate if the customer wants to save the card or not
tokensarray, mandatory
tokens.creditCardstring, optional25Pass the credit card token.
tokens.customerUniqueTokeninteger, optional8 (minimum)Pass customer unique token here. you will get saved card on payment page.
referencearray
reference.idstring, mandatory150Refers to the order or transaction ID in your own system we will save your ID for our reference.
customerarray, mandatory
customer.uniqueIdstring, mandatory150Pass customer unique ID for our reference
customer.namestring, mandatory50Pass customer name for our reference
customer.emailstring, mandatory50Pass customer email address here. If notificationType = email customer will receive the payment receipt on this email address.
customer.mobilenumber, mandatory10Pass customer phone number here. If notificationType = mobile customer will receive the payment sms on this mobile number.
returnUrlstring,mandatory250The return URL you like to have the successful payment
cancelUrlstring, mandatory250The cancel URL you like to have the cancel or failure payment
notificationUrlstring,mandatory250The notification URL will receive the webhook data
pluginarray, optional
plugin.srcstring, optional11Supported 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"
    }
}