curl --request POST \
--url https://api.paycashless.com/v1/invoices \
--header 'Content-Type: application/json' \
--header 'Request-Signature: <request-signature>' \
--header 'Request-Timestamp: <request-timestamp>' \
--data '
{
"reference": "<string>",
"description": "<string>",
"customer": {
"email": "[email protected]",
"name": "<string>",
"address": "<string>"
},
"items": [
{
"name": "<string>",
"quantity": 123,
"description": "<string>",
"price": 100000
}
],
"daysUntilDue": 30,
"acceptPartialPayments": false,
"sendEmail": false,
"autoFinalize": true,
"callbackUrl": "https://example.com/callback",
"returnUrl": "https://example.com/return",
"taxRateIds": [
"txr_1"
],
"maxInstallments": 3,
"metadata": {
"customer_id": "123",
"order_id": "456"
}
}
'import requests
url = "https://api.paycashless.com/v1/invoices"
payload = {
"reference": "<string>",
"description": "<string>",
"customer": {
"email": "[email protected]",
"name": "<string>",
"address": "<string>"
},
"items": [
{
"name": "<string>",
"quantity": 123,
"description": "<string>",
"price": 100000
}
],
"daysUntilDue": 30,
"acceptPartialPayments": False,
"sendEmail": False,
"autoFinalize": True,
"callbackUrl": "https://example.com/callback",
"returnUrl": "https://example.com/return",
"taxRateIds": ["txr_1"],
"maxInstallments": 3,
"metadata": {
"customer_id": "123",
"order_id": "456"
}
}
headers = {
"Request-Signature": "<request-signature>",
"Request-Timestamp": "<request-timestamp>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Request-Signature': '<request-signature>',
'Request-Timestamp': '<request-timestamp>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
reference: '<string>',
description: '<string>',
customer: {email: '[email protected]', name: '<string>', address: '<string>'},
items: [{name: '<string>', quantity: 123, description: '<string>', price: 100000}],
daysUntilDue: 30,
acceptPartialPayments: false,
sendEmail: false,
autoFinalize: true,
callbackUrl: 'https://example.com/callback',
returnUrl: 'https://example.com/return',
taxRateIds: ['txr_1'],
maxInstallments: 3,
metadata: {customer_id: '123', order_id: '456'}
})
};
fetch('https://api.paycashless.com/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paycashless.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([
'reference' => '<string>',
'description' => '<string>',
'customer' => [
'email' => '[email protected]',
'name' => '<string>',
'address' => '<string>'
],
'items' => [
[
'name' => '<string>',
'quantity' => 123,
'description' => '<string>',
'price' => 100000
]
],
'daysUntilDue' => 30,
'acceptPartialPayments' => false,
'sendEmail' => false,
'autoFinalize' => true,
'callbackUrl' => 'https://example.com/callback',
'returnUrl' => 'https://example.com/return',
'taxRateIds' => [
'txr_1'
],
'maxInstallments' => 3,
'metadata' => [
'customer_id' => '123',
'order_id' => '456'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Request-Signature: <request-signature>",
"Request-Timestamp: <request-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paycashless.com/v1/invoices"
payload := strings.NewReader("{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Signature", "<request-signature>")
req.Header.Add("Request-Timestamp", "<request-timestamp>")
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.paycashless.com/v1/invoices")
.header("Request-Signature", "<request-signature>")
.header("Request-Timestamp", "<request-timestamp>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paycashless.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Signature"] = '<request-signature>'
request["Request-Timestamp"] = '<request-timestamp>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"customerId": "<string>",
"description": "<string>",
"reference": "<string>",
"sendEmail": true,
"dueDate": "2023-11-07T05:31:56Z",
"liveMode": true,
"number": "0001",
"amountDue": 100000,
"amountPaid": 100000,
"totalInclusiveTaxAmount": 10000,
"totalExclusiveTaxAmount": 10000,
"taxRateIds": [
"tax_rate_1"
],
"items": [
{
"id": "<string>",
"name": "<string>",
"quantity": 123,
"price": 1000
}
],
"hostedInvoiceUrl": "https://invoicing.paycashless.com/inv_123",
"maxInstallments": 3
}Create an invoice
Create an invoice
curl --request POST \
--url https://api.paycashless.com/v1/invoices \
--header 'Content-Type: application/json' \
--header 'Request-Signature: <request-signature>' \
--header 'Request-Timestamp: <request-timestamp>' \
--data '
{
"reference": "<string>",
"description": "<string>",
"customer": {
"email": "[email protected]",
"name": "<string>",
"address": "<string>"
},
"items": [
{
"name": "<string>",
"quantity": 123,
"description": "<string>",
"price": 100000
}
],
"daysUntilDue": 30,
"acceptPartialPayments": false,
"sendEmail": false,
"autoFinalize": true,
"callbackUrl": "https://example.com/callback",
"returnUrl": "https://example.com/return",
"taxRateIds": [
"txr_1"
],
"maxInstallments": 3,
"metadata": {
"customer_id": "123",
"order_id": "456"
}
}
'import requests
url = "https://api.paycashless.com/v1/invoices"
payload = {
"reference": "<string>",
"description": "<string>",
"customer": {
"email": "[email protected]",
"name": "<string>",
"address": "<string>"
},
"items": [
{
"name": "<string>",
"quantity": 123,
"description": "<string>",
"price": 100000
}
],
"daysUntilDue": 30,
"acceptPartialPayments": False,
"sendEmail": False,
"autoFinalize": True,
"callbackUrl": "https://example.com/callback",
"returnUrl": "https://example.com/return",
"taxRateIds": ["txr_1"],
"maxInstallments": 3,
"metadata": {
"customer_id": "123",
"order_id": "456"
}
}
headers = {
"Request-Signature": "<request-signature>",
"Request-Timestamp": "<request-timestamp>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Request-Signature': '<request-signature>',
'Request-Timestamp': '<request-timestamp>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
reference: '<string>',
description: '<string>',
customer: {email: '[email protected]', name: '<string>', address: '<string>'},
items: [{name: '<string>', quantity: 123, description: '<string>', price: 100000}],
daysUntilDue: 30,
acceptPartialPayments: false,
sendEmail: false,
autoFinalize: true,
callbackUrl: 'https://example.com/callback',
returnUrl: 'https://example.com/return',
taxRateIds: ['txr_1'],
maxInstallments: 3,
metadata: {customer_id: '123', order_id: '456'}
})
};
fetch('https://api.paycashless.com/v1/invoices', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paycashless.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([
'reference' => '<string>',
'description' => '<string>',
'customer' => [
'email' => '[email protected]',
'name' => '<string>',
'address' => '<string>'
],
'items' => [
[
'name' => '<string>',
'quantity' => 123,
'description' => '<string>',
'price' => 100000
]
],
'daysUntilDue' => 30,
'acceptPartialPayments' => false,
'sendEmail' => false,
'autoFinalize' => true,
'callbackUrl' => 'https://example.com/callback',
'returnUrl' => 'https://example.com/return',
'taxRateIds' => [
'txr_1'
],
'maxInstallments' => 3,
'metadata' => [
'customer_id' => '123',
'order_id' => '456'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"Request-Signature: <request-signature>",
"Request-Timestamp: <request-timestamp>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paycashless.com/v1/invoices"
payload := strings.NewReader("{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Request-Signature", "<request-signature>")
req.Header.Add("Request-Timestamp", "<request-timestamp>")
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.paycashless.com/v1/invoices")
.header("Request-Signature", "<request-signature>")
.header("Request-Timestamp", "<request-timestamp>")
.header("Content-Type", "application/json")
.body("{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paycashless.com/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Request-Signature"] = '<request-signature>'
request["Request-Timestamp"] = '<request-timestamp>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reference\": \"<string>\",\n \"description\": \"<string>\",\n \"customer\": {\n \"email\": \"[email protected]\",\n \"name\": \"<string>\",\n \"address\": \"<string>\"\n },\n \"items\": [\n {\n \"name\": \"<string>\",\n \"quantity\": 123,\n \"description\": \"<string>\",\n \"price\": 100000\n }\n ],\n \"daysUntilDue\": 30,\n \"acceptPartialPayments\": false,\n \"sendEmail\": false,\n \"autoFinalize\": true,\n \"callbackUrl\": \"https://example.com/callback\",\n \"returnUrl\": \"https://example.com/return\",\n \"taxRateIds\": [\n \"txr_1\"\n ],\n \"maxInstallments\": 3,\n \"metadata\": {\n \"customer_id\": \"123\",\n \"order_id\": \"456\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"customerId": "<string>",
"description": "<string>",
"reference": "<string>",
"sendEmail": true,
"dueDate": "2023-11-07T05:31:56Z",
"liveMode": true,
"number": "0001",
"amountDue": 100000,
"amountPaid": 100000,
"totalInclusiveTaxAmount": 10000,
"totalExclusiveTaxAmount": 10000,
"taxRateIds": [
"tax_rate_1"
],
"items": [
{
"id": "<string>",
"name": "<string>",
"quantity": 123,
"price": 1000
}
],
"hostedInvoiceUrl": "https://invoicing.paycashless.com/inv_123",
"maxInstallments": 3
}Headers
SHA-512 HMAC signature of the request payload using the API secret
1"5e73d044c44d733fcf819ad3409aaaddca840d421b69cb0b04e2c750fc62ece7526d36296237663ad1f06f62a730c0466516507196b3ce6567493cc52a7cf63d"
UNIX timestamp when the request was created (in seconds)
^\d{10}$"1712336881"
Body
NGN, USD Show child attributes
Show child attributes
20Show child attributes
Show child attributes
The number of days until the invoice is due
0 < x <= 180030
Whether to automatically finalize the invoice, invoice will be in draft state if this is false
true
The URL to call when the invoice is paid
"https://example.com/callback"
The URL to redirect to when the invoice is paid
"https://example.com/return"
The tax rates to apply to the invoice
["txr_1"]
The maximum number of installments the customer can pay in, only required when acceptPartialPayments is true
3
Additional metadata for the invoice
Show child attributes
Show child attributes
{ "customer_id": "123", "order_id": "456" }
Response
Invoice created successfully
draft, open, paid, partially_paid, cancelled NGN, USD The number of the invoice
"0001"
The total amount due for the invoice in smallest currency unit
x > 0100000
The total amount paid for the invoice in smallest currency unit
x > 0100000
The total inclusive tax amount for the invoice in smallest currency unit
x > 010000
The total exclusive tax amount for the invoice in smallest currency unit
x > 010000
The tax rates applied to the invoice
["tax_rate_1"]
Show child attributes
Show child attributes
The URL to the hosted invoice payment page
"https://invoicing.paycashless.com/inv_123"
The maximum number of installments the customer can pay in
3