Create Invoice
curl --request POST \
--url https://api.atlas.co/functions/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "<string>",
"subscription": "<string>",
"days_until_due": 123,
"description": "<string>",
"auto_advance": true,
"metadata": {}
}
'import requests
url = "https://api.atlas.co/functions/v1/invoices"
payload = {
"customer": "<string>",
"subscription": "<string>",
"days_until_due": 123,
"description": "<string>",
"auto_advance": True,
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
subscription: '<string>',
days_until_due: 123,
description: '<string>',
auto_advance: true,
metadata: {}
})
};
fetch('https://api.atlas.co/functions/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.atlas.co/functions/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([
'customer' => '<string>',
'subscription' => '<string>',
'days_until_due' => 123,
'description' => '<string>',
'auto_advance' => true,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.atlas.co/functions/v1/invoices"
payload := strings.NewReader("{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.atlas.co/functions/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atlas.co/functions/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "invoice",
"number": "<string>",
"customer": "<string>",
"subscription": "<string>",
"collection_method": "<string>",
"currency": "<string>",
"amount_due": 123,
"amount_paid": 123,
"amount_remaining": 123,
"subtotal": 123,
"tax": 123,
"total": 123,
"description": "<string>",
"due_date": 123,
"period_start": 123,
"period_end": 123,
"lines": {
"object": "list",
"data": [
{
"id": "<string>",
"object": "line_item",
"amount": 123,
"currency": "<string>",
"description": "<string>",
"price": {
"id": "<string>",
"product": "<string>"
},
"quantity": 123,
"period": {
"start": 123,
"end": 123
}
}
]
},
"paid": true,
"paid_at": 123,
"voided_at": 123,
"hosted_invoice_url": "<string>",
"metadata": {},
"created": 123
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Invoices
Create Invoice
POST
/
invoices
Create Invoice
curl --request POST \
--url https://api.atlas.co/functions/v1/invoices \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer": "<string>",
"subscription": "<string>",
"days_until_due": 123,
"description": "<string>",
"auto_advance": true,
"metadata": {}
}
'import requests
url = "https://api.atlas.co/functions/v1/invoices"
payload = {
"customer": "<string>",
"subscription": "<string>",
"days_until_due": 123,
"description": "<string>",
"auto_advance": True,
"metadata": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer: '<string>',
subscription: '<string>',
days_until_due: 123,
description: '<string>',
auto_advance: true,
metadata: {}
})
};
fetch('https://api.atlas.co/functions/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.atlas.co/functions/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([
'customer' => '<string>',
'subscription' => '<string>',
'days_until_due' => 123,
'description' => '<string>',
'auto_advance' => true,
'metadata' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.atlas.co/functions/v1/invoices"
payload := strings.NewReader("{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.atlas.co/functions/v1/invoices")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.atlas.co/functions/v1/invoices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer\": \"<string>\",\n \"subscription\": \"<string>\",\n \"days_until_due\": 123,\n \"description\": \"<string>\",\n \"auto_advance\": true,\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "invoice",
"number": "<string>",
"customer": "<string>",
"subscription": "<string>",
"collection_method": "<string>",
"currency": "<string>",
"amount_due": 123,
"amount_paid": 123,
"amount_remaining": 123,
"subtotal": 123,
"tax": 123,
"total": 123,
"description": "<string>",
"due_date": 123,
"period_start": 123,
"period_end": 123,
"lines": {
"object": "list",
"data": [
{
"id": "<string>",
"object": "line_item",
"amount": 123,
"currency": "<string>",
"description": "<string>",
"price": {
"id": "<string>",
"product": "<string>"
},
"quantity": 123,
"period": {
"start": 123,
"end": 123
}
}
]
},
"paid": true,
"paid_at": 123,
"voided_at": 123,
"hosted_invoice_url": "<string>",
"metadata": {},
"created": 123
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"request_id": "<string>"
}
}Authorizations
API key (sk_test_* or sk_live_*)
Body
application/json
Response
Invoice created
Available options:
invoice Available options:
draft, open, paid, void, uncollectible, past_due Show child attributes
Show child attributes
Show child attributes
Show child attributes
⌘I