---
title: Create Invoice
description: Create an invoice for a customer to accept payment, returning an invoice number and payment URL.
---

This API will create an invoice for the customer in order to accept the payment. We must pass data containing the complete details of invoice and customer in request. If the request has valid details, we will get an invoice number and payment url for the transaction.

#### POST

```
https://kraken.airpay.co.in/airpay/ms/invoicepay/api/create
```

## Request Body

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| data  required | Json|Xml | Data value can be passed in json or xml.The data should be in this format only.This contains the complete details of invoice and customer. (required) |
| token  required | String | Unique token need to be passed by every company (length 1-150) Calculated by md5(access-token . '~' . json_encode(data)); access-token : Provided by airpay data data : parameter passed in the request | `91f5evhk72f56432ec678sdfes685h42sd2t21k430912508233b7r37562g2hps` |
| format  required | String | Mention the format of data param in the api (length 1-7)<br>Eg. Json or xml | `json` |
| expiry_date  required | Date | Set the expiry date of invoice<br>Eg. 2022-08-15 19:57:23 (Year-Month-Day Hour:Minute:Second) | `2022-08-15 19:57:23` |

## Success 200

| Parameter | Type Value | Description | Value Like |
| --- | --- | --- | --- |
| success  required | Alphanumeric | Success or not<br>Success - 200 (The transaction is success)<br>Transaction in Process - 211 (The transaction is processing)<br>Failed - 400 (The transaction is failed)<br>Dropped - 401 (The transaction will not register properly)<br>Cancel - 402 (payment that has not yet been processed)<br>Incomplete - 403 (Not recieved any call back from bank)<br>Bounced - 405 (The transaction has bounced)<br>No Records - 503 (There are no records found) | `200` |
| invoice_number  required | Numeric | Invoice number | `1234745234245` |
| payment_url  required | String | Payment url | `https://abc.invpay.co.in/invoice/OSYzMjc1NQ==` |

## Request Example

```
{
     token: "91f5evhk72f56432ec678sdfes685h42sd2t21k430912508233b7r37562g2hps",
     data:   {
                 "MERCHANT_ID":1088,
                 "INVOICE_NUMBER":"1234745234245",
                 "TOTAL_AMOUNT":14.0,
                 "MODE":"pgdc",
                 "customer": {
                                 "FIRST_NAME":"Vikasvijesh",
                                 "LAST_NAME":"",
                                 "EMAIL":"newcompany@xyz.com",
                                 "PHONE":"9XXXXXX433",
                                 "CITY":"Delhi ",
                                 "STATE":"Delhi ",
                                 "COUNTRY":"India",
                                 "PINCODE":"110001",
                                 "ADDRESS":null
                             },
                 "invoice_item": {
                                     "ITEM_NAME":"Loan Repayment",
                                     "ITEM_DESCRIPTION":"",
                                     "ITEM_PRICE":14.0,
                                     "ITEM_QUANTITY":1,
                                     "ITEM_TAX":0.0,
                                     "ITEM_IMAGE":""
                                 },
                 "CHARGE":,
                 "SEND_REQUEST": {
                                     "EMAIL":false,
                                     "SMS":true
                                 },
                 "CUSTOM_DATA":  {
                                     "my_custome_field":"abc1234"
                                 }
             },
     format: "json",
     expiry_date: "2022-08-15 19:57:23"
}
```

### Success Response

```
HTTP/1.1 200 OK
{
     "success": true,
     "invoice_number": "1234745234245",
     "payment_url": "https://abc.invpay.co.in/invoice/OSYzMjc1NQ=="
}
```

### Error Response

```
HTTP/1.1 502 Not Found
 {
     "status": 502,
     "message": []
 }
```