List Invoices
Retrieve the basic data of an invoice, with individual invoice lines.
customer
ID of the customer. String starting with cus_.
date
Date that the invoice was created.
due_date
The date payment is due on this invoice. This value is calculated from the date the invoice is created, plus the number of days specified in the 'days_until_due' field. Format is in Unix time.
ending_before
The ID of the invoice created after the last invoice you want to retrieve.
limit
The maximum number of invoices to return. Range: 1-100.
10
starting_after
The ID of the invoice created before the first invoice you want to retrieve.
subscription
ID of the subscription. String starting with sub_.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string result = RapydApiRequestSample.Utilities.MakeRequest("GET", "/v1/invoices?limit=3"); Console.WriteLine(result); } catch (Exception e) { Console.WriteLine("Error completing request: " + e.Message); } } } }
JavaScript
const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest; async function main() { try { const result = await makeRequest( 'GET', '/v1/invoices?limit=3' ); console.log(result); } catch (error) { console.error('Error completing request', error); } }
PHP
<?php $path .= "/<path-to-your-utility-file>/utilities.php"; include($path); try { $object = make_request('get', "/v1/invoices?limit=3"); var_dump($object); } catch(Exception $e) { echo "Error: $e"; } ?>
Python
from pprint import pprint from utilities import make_request result = make_request(method='get', path='/v1/invoices?limit=3') pprint(result)
/v1/invoices
List Invoices
curl -X get https://sandboxapi.rapyd.net/v1/invoices?limit=2 -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "77adb15e-a390-4f01-987b-269130a2e60f" }, "data": [ { "id": "invoice_00d380aa2d2a361e7407a762c9645ed1", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1701849911000, "currency": "USD", "customer": "cus_4dbe0bb77ab9a492bc42092955f2d816", "description": "", "discount": null, "due_date": 1562845266000, "days_until_due": 0, "metadata": {}, "number": 0, "payment": null, "payout": null, "payment_fields": null, "period_end": null, "period_start": null, "lines": [], "statement_descriptor": "", "subscription": "", "discount_amount": 0, "subtotal": 0, "tax": 0, "tax_percent": 0, "total": 0, "status": "draft", "payout_fields": null, "type": "payment", "next_payment_attempt": 0, "automatic_attempt_count": 0 }, { "id": "invoice_0521a5b850bea9c2a2f9d7d8d60589a7", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1701849911000, "currency": "USD", "customer": "cus_4dbe0bb77ab9a492bc42092955f2d816", "description": "", "discount": null, "due_date": 1562845266000, "days_until_due": 0, "metadata": {}, "number": 0, "payment": null, "payout": null, "payment_fields": null, "period_end": null, "period_start": null, "lines": [], "statement_descriptor": "", "subscription": "", "discount_amount": 0, "subtotal": 0, "tax": 0, "tax_percent": 0, "total": 0, "status": "draft", "payout_fields": null, "type": "payment", "next_payment_attempt": 0, "automatic_attempt_count": 0 } ] }
List Invoices for Subscription
curl -X get https://sandboxapi.rapyd.net/v1/invoices?subscription=sub_0ecc9456e3ddfd508c3bc0a3cf80bfeb -H 'access_key: your-access-key-here' -H 'Content-Type: application/json' -H 'idempotency: your-idempotency-parameter-here' -H 'salt: your-random-string-here' -H 'signature: your-calculated-signature-here' -H 'timestamp: your-unix-timestamp-here'
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "bab107aa-8a9b-4c91-ab0d-effe8add0e42" }, "data": [ { "id": "invoice_54cf2f725677138f698ac68808e30fe0", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1701849911000, "currency": "USD", "customer": "cus_ec644ad88259ee3deea6dd98cd2b3f6f", "description": "", "discount": null, "due_date": null, "days_until_due": 0, "metadata": {}, "number": 0, "payment": null, "payout": null, "payment_fields": null, "period_end": 1701849908000, "period_start": 1701849092000, "lines": [], "statement_descriptor": "", "subscription": "sub_0ecc9456e3ddfd508c3bc0a3cf80bfeb", "discount_amount": 0, "subtotal": 0, "tax": 0, "tax_percent": 0, "total": 0, "status": "paid", "payout_fields": null, "type": "payment", "next_payment_attempt": 0, "automatic_attempt_count": 0 }, { "id": "invoice_a87d5fa33216972acd2ccd9972ce0112", "attempt_count": 4, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1701849092000, "currency": "USD", "customer": "cus_ec644ad88259ee3deea6dd98cd2b3f6f", "description": "", "discount": null, "due_date": 1704441092000, "days_until_due": 0, "metadata": {}, "number": 0, "payment": null, "payout": null, "payment_fields": null, "period_end": 1701935491000, "period_start": 1701849092000, "lines": [ { "id": "il_50ee77ed2e808f52c5e22aae8fc81b13", "amount": 0.06, "currency": "USD", "description": "IDV Checks", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1701849092, "end": 1701935491 }, "proration": false, "quantity": 1, "plan": { "id": "plan_0cf385a1b596aa4a07352b1286335784", "aggregate_usage": "sum", "amount": 2, "billing_scheme": "per_unit", "created_at": 1701849090, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "", "tiers": [], "tiers_mode": "", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": true }, "subscription": "sub_0ecc9456e3ddfd508c3bc0a3cf80bfeb", "subscription_item": "subi_7426f52c6457d087a9dace34703a8e8d", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_0ecc9456e3ddfd508c3bc0a3cf80bfeb", "discount_amount": 0, "subtotal": 0.06, "tax": 0, "tax_percent": 0, "total": 0.06, "status": "open", "payout_fields": null, "type": "payment", "next_payment_attempt": 0, "automatic_attempt_count": 3 } ] }