Skip to main content

Documentation

List Invoices

Retrieve a list of all invoices that you have created. You can filter the list with query parameters.

    • 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": "6dc4caca-8720-4082-b0d7-bad67eba0915"
        },
        "data": [
            {
                "id": "invoice_6dad95c1d91a47b8c59728eaccdd8c1c",
                "attempt_count": 0,
                "billing": "pay_automatically",
                "billing_reason": "subscription_cycle",
                "created_at": 1761613560000,
                "currency": "USD",
                "customer": "cus_5bee14584a78638ba717e746be62ee01",
                "description": "",
                "discount": null,
                "due_date": 1764205560000,
                "days_until_due": 0,
                "metadata": {},
                "payment": null,
                "payout": null,
                "payment_fields": null,
                "period_end": 1762269042000,
                "period_start": 1761664242000,
                "lines": [
                    {
                        "id": "il_cd7fc7874db4d422456ade7a2e242196",
                        "amount": 500,
                        "currency": "USD",
                        "description": "SEO",
                        "discountable": true,
                        "invoice_item": "",
                        "metadata": {},
                        "period": {
                            "start": 1761664242,
                            "end": 1762269042
                        },
                        "proration": false,
                        "quantity": 1,
                        "plan": {
                            "id": "plan_82f9aebe54be79ae567293bb29ffd5a2",
                            "aggregate_usage": "sum",
                            "amount": 500,
                            "billing_scheme": "per_unit",
                            "created_at": 1668940516,
                            "currency": "USD",
                            "interval": "week",
                            "interval_count": 1,
                            "metadata": {},
                            "nickname": "Weekly SEO Basic",
                            "tiers": [],
                            "tiers_mode": "",
                            "transform_usage": {
                                "divide_by": 1,
                                "round": "up"
                            },
                            "trial_period_days": 0,
                            "usage_type": "licensed",
                            "active": false
                        },
                        "subscription": "sub_b45547bd37ba2dc9094dcd7b62983550",
                        "subscription_item": "subi_8868f1d4101cf4798324b9733e4bc550",
                        "type": "subscription"
                    }
                ],
                "statement_descriptor": "",
                "subscription": "sub_b45547bd37ba2dc9094dcd7b62983550",
                "discount_amount": 0,
                "subtotal": 500,
                "tax": 0,
                "tax_percent": 0,
                "total": 500,
                "status": "draft",
                "payout_fields": null,
                "type": "payment"
            },
            {
                "id": "invoice_9c742e321151e05b8ecde0bfa3f260ef",
                "attempt_count": 0,
                "billing": "pay_automatically",
                "billing_reason": "subscription_cycle",
                "created_at": 1761613512000,
                "currency": "USD",
                "customer": "cus_5bee14584a78638ba717e746be62ee01",
                "description": "",
                "discount": null,
                "due_date": 1764205512000,
                "days_until_due": 0,
                "metadata": {},
                "payment": null,
                "payout": null,
                "payment_fields": null,
                "period_end": 1762269088000,
                "period_start": 1761664288000,
                "lines": [
                    {
                        "id": "il_29a11ef7080ce7d1c8a1ba4ceafc1162",
                        "amount": 500,
                        "currency": "USD",
                        "description": "SEO",
                        "discountable": true,
                        "invoice_item": "",
                        "metadata": {},
                        "period": {
                            "start": 1761664288,
                            "end": 1762269088
                        },
                        "proration": false,
                        "quantity": 1,
                        "plan": {
                            "id": "plan_82f9aebe54be79ae567293bb29ffd5a2",
                            "aggregate_usage": "sum",
                            "amount": 500,
                            "billing_scheme": "per_unit",
                            "created_at": 1668940516,
                            "currency": "USD",
                            "interval": "week",
                            "interval_count": 1,
                            "metadata": {},
                            "nickname": "Weekly SEO Basic",
                            "tiers": [],
                            "tiers_mode": "",
                            "transform_usage": {
                                "divide_by": 1,
                                "round": "up"
                            },
                            "trial_period_days": 0,
                            "usage_type": "licensed",
                            "active": false
                        },
                        "subscription": "sub_420d05fbf9880585aa0d3aab1d46b07c",
                        "subscription_item": "subi_5983b66e297926bbec29c26f1c7123da",
                        "type": "subscription"
                    }
                ],
                "statement_descriptor": "",
                "subscription": "sub_420d05fbf9880585aa0d3aab1d46b07c",
                "discount_amount": 0,
                "subtotal": 500,
                "tax": 0,
                "tax_percent": 0,
                "total": 500,
                "status": "draft",
                "payout_fields": null,
                "type": "payment"
            }
        ]
    }
  • List Invoices for Subscription

  • curl -X get 'https://sandboxapi.rapyd.net/v1/invoices?subscription=sub_b2db5191d9623a958697614d665a5be5&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": "69a92147-6517-4e4e-805d-44a6e6061f3b"
        },
        "data": [
            {
                "id": "invoice_777377c23b361c4a205878173454fe52",
                "attempt_count": 0,
                "billing": "pay_automatically",
                "billing_reason": "subscription_create",
                "created_at": 1761221728000,
                "currency": "USD",
                "customer": "cus_4e25112ac20e144ad073a614dc46934b",
                "description": "",
                "discount": null,
                "due_date": 1763813728000,
                "days_until_due": 0,
                "metadata": {},
                "payment": null,
                "payout": null,
                "payment_fields": null,
                "period_end": 1766492127000,
                "period_start": 1761221727000,
                "lines": [
                    {
                        "id": "il_7cf482fa969103c20997b834d49baa40",
                        "amount": 60,
                        "currency": "USD",
                        "description": "SaaS Users",
                        "discountable": true,
                        "invoice_item": "",
                        "metadata": {},
                        "period": {
                            "start": 1761221727,
                            "end": 1766492127
                        },
                        "proration": false,
                        "quantity": 1,
                        "plan": {
                            "id": "plan_9338044c6ca654abd79da7319c40b7dc",
                            "aggregate_usage": "sum",
                            "amount": 0,
                            "billing_scheme": "tiered",
                            "created_at": 1761210135,
                            "currency": "USD",
                            "interval": "month",
                            "interval_count": 2,
                            "metadata": {},
                            "nickname": "SaaS Users",
                            "tiers": [
                                {
                                    "amount": 35,
                                    "up_to": 5,
                                    "flat_amount": 25
                                },
                                {
                                    "amount": 30,
                                    "up_to": 10,
                                    "flat_amount": 0
                                },
                                {
                                    "amount": 25,
                                    "up_to": 25,
                                    "flat_amount": 0
                                },
                                {
                                    "amount": 20,
                                    "up_to": 100,
                                    "flat_amount": 0
                                },
                                {
                                    "amount": 15,
                                    "up_to": 500,
                                    "flat_amount": 0
                                },
                                {
                                    "amount": 10,
                                    "up_to": "inf",
                                    "flat_amount": 0
                                }
                            ],
                            "tiers_mode": "volume",
                            "transform_usage": {
                                "divide_by": 1,
                                "round": "up"
                            },
                            "trial_period_days": 0,
                            "usage_type": "licensed",
                            "active": true
                        },
                        "subscription": "sub_b2db5191d9623a958697614d665a5be5",
                        "subscription_item": "subi_fd4d2d48578564f16c3c19d3e09612b9",
                        "type": "subscription"
                    }
                ],
                "statement_descriptor": "",
                "subscription": "sub_b2db5191d9623a958697614d665a5be5",
                "discount_amount": 0,
                "subtotal": 60,
                "tax": 0,
                "tax_percent": 0,
                "total": 60,
                "status": "paid",
                "payout_fields": null,
                "type": "payment"
            }
        ]
    }