List all charges
GET
https://api.ledgerline.dev /v2/charges Returns a list of charges you've previously created, most recent first.
Parameters
limitintegerqueryA limit on the number of objects to be returned, between 1 and 100.
starting_afterstringqueryA cursor for pagination: an object ID that defines your place in the list.
Code samples
cURL
curl -X GET "https://api.ledgerline.dev/v2/charges?limit=&starting_after="TypeScript
const res = await fetch('https://api.ledgerline.dev/v2/charges?limit=&starting_after=', {
method: 'GET',
});
const data = await res.json();Python
import requests
res = requests.request(
"GET",
"https://api.ledgerline.dev/v2/charges?limit=&starting_after=",
)
data = res.json()Go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.ledgerline.dev/v2/charges?limit=&starting_after=", nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.ledgerline.dev/v2/charges?limit=&starting_after=');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;Ruby
require 'net/http'
require 'uri'
uri = URI('https://api.ledgerline.dev/v2/charges?limit=&starting_after=')
req = Net::HTTP::Get.new(uri)
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts res.bodyJava
import java.net.URI;
import java.net.http.*;
import java.net.http.HttpRequest.BodyPublishers;
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.ledgerline.dev/v2/charges?limit=&starting_after="))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());Responses
200 A dictionary with a data property that contains an array of charges.
{
"object": "list",
"has_more": false,
"data": [
{
"id": "ch_3MmlLrLkdIwHu7ix0snN0B15",
"object": "charge",
"amount": 4800,
"amount_refunded": 0,
"currency": "usd",
"customer": "cus_Qm8xT2vLp0aZ",
"description": "Canvas tote",
"captured": true,
"paid": true,
"status": "succeeded",
"created": 1791787234,
"livemode": false
}
]
}402 The request was valid but failed (for example, the card was declined).
Updated
Was this page helpful?