List credit ledger entries
curl --request POST \
--url https://api.metronome.com/v1/credits/listEntries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"starting_on": "2021-01-01T00:00:00Z",
"ending_before": "2021-02-01T00:00:00Z",
"customer_ids": [
"6a37bb88-8538-48c5-b37b-a41c836328bd"
],
"credit_type_ids": [
"2714e483-4ff1-48e4-9e25-ac732e8f24f2"
]
}
'import requests
url = "https://api.metronome.com/v1/credits/listEntries"
payload = {
"starting_on": "2021-01-01T00:00:00Z",
"ending_before": "2021-02-01T00:00:00Z",
"customer_ids": ["6a37bb88-8538-48c5-b37b-a41c836328bd"],
"credit_type_ids": ["2714e483-4ff1-48e4-9e25-ac732e8f24f2"]
}
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({
starting_on: '2021-01-01T00:00:00Z',
ending_before: '2021-02-01T00:00:00Z',
customer_ids: ['6a37bb88-8538-48c5-b37b-a41c836328bd'],
credit_type_ids: ['2714e483-4ff1-48e4-9e25-ac732e8f24f2']
})
};
fetch('https://api.metronome.com/v1/credits/listEntries', 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.metronome.com/v1/credits/listEntries",
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([
'starting_on' => '2021-01-01T00:00:00Z',
'ending_before' => '2021-02-01T00:00:00Z',
'customer_ids' => [
'6a37bb88-8538-48c5-b37b-a41c836328bd'
],
'credit_type_ids' => [
'2714e483-4ff1-48e4-9e25-ac732e8f24f2'
]
]),
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.metronome.com/v1/credits/listEntries"
payload := strings.NewReader("{\n \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\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.metronome.com/v1/credits/listEntries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/credits/listEntries")
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 \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"customer_id": "6a37bb88-8538-48c5-b37b-a41c836328bd",
"ledgers": [
{
"credit_type": {
"id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
"name": "USD (cents)"
},
"starting_balance": {
"including_pending": 400,
"excluding_pending": 400,
"effective_at": "2021-01-01T00:00:00Z"
},
"ending_balance": {
"including_pending": 110,
"excluding_pending": 400,
"effective_at": "2021-02-01T00:00:00Z"
},
"entries": [],
"pending_entries": [
{
"amount": 290,
"reason": "Automated invoice deduction",
"running_balance": 110,
"effective_at": "2021-02-01T00:00:00Z",
"created_by": "Metronome System",
"credit_grant_id": "f06b3d1b-c724-4e0b-99d1-20c0526bf21b",
"invoice_id": "92fb6de8-eb2f-47e5-ae1b-b1e0fb1f388d"
}
]
}
]
}
],
"next_page": null
}{
"message": "<string>"
}Credits
List credit ledger entries
Fetches a list of credit ledger entries. Returns lists of ledgers per customer. Ledger entries are returned in chronological order. Ledger entries associated with voided credit grants are not included. This is a Plans (deprecated) endpoint. New clients should implement using Contracts.
POST
/
credits
/
listEntries
List credit ledger entries
curl --request POST \
--url https://api.metronome.com/v1/credits/listEntries \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"starting_on": "2021-01-01T00:00:00Z",
"ending_before": "2021-02-01T00:00:00Z",
"customer_ids": [
"6a37bb88-8538-48c5-b37b-a41c836328bd"
],
"credit_type_ids": [
"2714e483-4ff1-48e4-9e25-ac732e8f24f2"
]
}
'import requests
url = "https://api.metronome.com/v1/credits/listEntries"
payload = {
"starting_on": "2021-01-01T00:00:00Z",
"ending_before": "2021-02-01T00:00:00Z",
"customer_ids": ["6a37bb88-8538-48c5-b37b-a41c836328bd"],
"credit_type_ids": ["2714e483-4ff1-48e4-9e25-ac732e8f24f2"]
}
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({
starting_on: '2021-01-01T00:00:00Z',
ending_before: '2021-02-01T00:00:00Z',
customer_ids: ['6a37bb88-8538-48c5-b37b-a41c836328bd'],
credit_type_ids: ['2714e483-4ff1-48e4-9e25-ac732e8f24f2']
})
};
fetch('https://api.metronome.com/v1/credits/listEntries', 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.metronome.com/v1/credits/listEntries",
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([
'starting_on' => '2021-01-01T00:00:00Z',
'ending_before' => '2021-02-01T00:00:00Z',
'customer_ids' => [
'6a37bb88-8538-48c5-b37b-a41c836328bd'
],
'credit_type_ids' => [
'2714e483-4ff1-48e4-9e25-ac732e8f24f2'
]
]),
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.metronome.com/v1/credits/listEntries"
payload := strings.NewReader("{\n \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\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.metronome.com/v1/credits/listEntries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/credits/listEntries")
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 \"starting_on\": \"2021-01-01T00:00:00Z\",\n \"ending_before\": \"2021-02-01T00:00:00Z\",\n \"customer_ids\": [\n \"6a37bb88-8538-48c5-b37b-a41c836328bd\"\n ],\n \"credit_type_ids\": [\n \"2714e483-4ff1-48e4-9e25-ac732e8f24f2\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"customer_id": "6a37bb88-8538-48c5-b37b-a41c836328bd",
"ledgers": [
{
"credit_type": {
"id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
"name": "USD (cents)"
},
"starting_balance": {
"including_pending": 400,
"excluding_pending": 400,
"effective_at": "2021-01-01T00:00:00Z"
},
"ending_balance": {
"including_pending": 110,
"excluding_pending": 400,
"effective_at": "2021-02-01T00:00:00Z"
},
"entries": [],
"pending_entries": [
{
"amount": 290,
"reason": "Automated invoice deduction",
"running_balance": 110,
"effective_at": "2021-02-01T00:00:00Z",
"created_by": "Metronome System",
"credit_grant_id": "f06b3d1b-c724-4e0b-99d1-20c0526bf21b",
"invoice_id": "92fb6de8-eb2f-47e5-ae1b-b1e0fb1f388d"
}
]
}
]
}
],
"next_page": null
}{
"message": "<string>"
}Authorizations
Query Parameters
Body
application/json
Optional filters on the ledger entries to return