Create an invoice
Creates a new invoice to bill a customer for products or services.
POST
/
invoices
Create an invoice
curl --request POST \
--url https://api.razorpay.com/v1/invoices \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "invoice",
"customer": {
"name": "Gaurav Kumar",
"email": "gaurav.kumar@example.com",
"contact": "+919876543210"
},
"line_items": [
{
"name": "Consulting Services",
"amount": 100000,
"quantity": 1
}
],
"description": "Invoice for Q1 services",
"currency": "INR"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'invoice',
customer: {
name: 'Gaurav Kumar',
email: 'gaurav.kumar@example.com',
contact: '+919876543210'
},
line_items: [{name: 'Consulting Services', amount: 100000, quantity: 1}],
description: 'Invoice for Q1 services',
currency: 'INR'
})
};
fetch('https://api.razorpay.com/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.razorpay.com/v1/invoices"
payload = {
"type": "invoice",
"customer": {
"name": "Gaurav Kumar",
"email": "gaurav.kumar@example.com",
"contact": "+919876543210"
},
"line_items": [
{
"name": "Consulting Services",
"amount": 100000,
"quantity": 1
}
],
"description": "Invoice for Q1 services",
"currency": "INR"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.razorpay.com/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'invoice',
'customer' => [
'name' => 'Gaurav Kumar',
'email' => 'gaurav.kumar@example.com',
'contact' => '+919876543210'
],
'line_items' => [
[
'name' => 'Consulting Services',
'amount' => 100000,
'quantity' => 1
]
],
'description' => 'Invoice for Q1 services',
'currency' => 'INR'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.razorpay.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.razorpay.com/v1/invoices"
payload := strings.NewReader("{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.razorpay.com/v1/invoices")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}")
.asString();{
"id": "inv_FgR9UMzgmKDJRi",
"entity": "invoice",
"status": "issued",
"short_url": "https://rzp.io/i/w2CEwYmkAu"
}Authorizations
Use your Razorpay Key ID as the username and Key Secret as the password.
Body
application/json
Type of invoice. Use invoice for regular invoices.
Available options:
invoice, link Example:
"invoice"
Customer details for the invoice.
Show child attributes
Show child attributes
List of items in the invoice.
Show child attributes
Show child attributes
Description of the invoice.
Example:
"Invoice for Q1 services"
Currency code (ISO 4217).
Example:
"INR"
Was this page helpful?
⌘I
Create an invoice
curl --request POST \
--url https://api.razorpay.com/v1/invoices \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "invoice",
"customer": {
"name": "Gaurav Kumar",
"email": "gaurav.kumar@example.com",
"contact": "+919876543210"
},
"line_items": [
{
"name": "Consulting Services",
"amount": 100000,
"quantity": 1
}
],
"description": "Invoice for Q1 services",
"currency": "INR"
}
'const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({
type: 'invoice',
customer: {
name: 'Gaurav Kumar',
email: 'gaurav.kumar@example.com',
contact: '+919876543210'
},
line_items: [{name: 'Consulting Services', amount: 100000, quantity: 1}],
description: 'Invoice for Q1 services',
currency: 'INR'
})
};
fetch('https://api.razorpay.com/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.razorpay.com/v1/invoices"
payload = {
"type": "invoice",
"customer": {
"name": "Gaurav Kumar",
"email": "gaurav.kumar@example.com",
"contact": "+919876543210"
},
"line_items": [
{
"name": "Consulting Services",
"amount": 100000,
"quantity": 1
}
],
"description": "Invoice for Q1 services",
"currency": "INR"
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.razorpay.com/v1/invoices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'type' => 'invoice',
'customer' => [
'name' => 'Gaurav Kumar',
'email' => 'gaurav.kumar@example.com',
'contact' => '+919876543210'
],
'line_items' => [
[
'name' => 'Consulting Services',
'amount' => 100000,
'quantity' => 1
]
],
'description' => 'Invoice for Q1 services',
'currency' => 'INR'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}require 'uri'
require 'net/http'
url = URI("https://api.razorpay.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.razorpay.com/v1/invoices"
payload := strings.NewReader("{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.razorpay.com/v1/invoices")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"invoice\",\n \"customer\": {\n \"name\": \"Gaurav Kumar\",\n \"email\": \"gaurav.kumar@example.com\",\n \"contact\": \"+919876543210\"\n },\n \"line_items\": [\n {\n \"name\": \"Consulting Services\",\n \"amount\": 100000,\n \"quantity\": 1\n }\n ],\n \"description\": \"Invoice for Q1 services\",\n \"currency\": \"INR\"\n}")
.asString();{
"id": "inv_FgR9UMzgmKDJRi",
"entity": "invoice",
"status": "issued",
"short_url": "https://rzp.io/i/w2CEwYmkAu"
}