Retrieve Invoice Lines from Invoice
Retrieve invoice lines from an invoice.
Invoice lines are subscription items or invoice items.
invoice
ID of the invoice. String starting with invoice_.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string invoice = "invoice_6bfb9a7b969e6ceb7675659db01cb7f0"; string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/invoices/{invoice}/lines"); 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/invoice_6bfb9a7b969e6ceb7675659db01cb7f0/lines' ); 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/invoice_6bfb9a7b969e6ceb7675659db01cb7f0/lines"); 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/invoice_6bfb9a7b969e6ceb7675659db01cb7f0/lines') pprint(result)
/v1/invoices/:invoice/lines
Retrieve Invoice Lines from Invoice
curl -X get 'https://sandboxapi.rapyd.net/v1/invoices/invoice_e7a973caf0dd43e73707fe22767c268f/lines' \ -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": "f1224c24-bfc6-4ce7-9531-b9cc2786e018" }, "data": [ { "id": "invoice_f4fa52843bd6df2c0c8ff38b514b8405", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763600540000, "currency": "USD", "customer": "cus_d3ed65d5091a8398cc3651bcedec1201", "description": "", "discount": null, "due_date": 1766192540000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1766235743000, "period_start": 1763643743000, "lines": [ { "id": "il_cdd496e8e007d9229e724837aa2af695", "amount": 3, "currency": "USD", "description": "Monthly parking", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763643743, "end": 1766235743 }, "proration": false, "quantity": 1, "plan": { "id": "plan_b2cc9c3bf495a2997d7046e46eb17a02", "aggregate_usage": "sum", "amount": 3, "billing_scheme": "per_unit", "created_at": 1617703798, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Basic", "tiers": [], "tiers_mode": "", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": false }, "subscription": "sub_3b39434969769fff7d26204b4ac14333", "subscription_item": "subi_6cc8e76e65f961933af6648b678636b3", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_3b39434969769fff7d26204b4ac14333", "discount_amount": 0, "subtotal": 3, "tax": 0, "tax_percent": 0, "total": 3, "status": "draft", "payout_fields": null, "type": "payment" }, { "id": "invoice_e7a973caf0dd43e73707fe22767c268f", "attempt_count": 1, "billing": "pay_automatically", "billing_reason": "manual", "created_at": 1763561380000, "currency": "USD", "customer": "cus_4e25112ac20e144ad073a614dc46934b", "description": "", "discount": null, "due_date": 1766153380000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": null, "period_start": null, "lines": [ { "id": "il_e89ff184af1324212edbd583afca20f6", "amount": 19.99, "currency": "USD", "description": "Remaining time on Unlimited Music after 18 Nov 2025", "discountable": false, "invoice_item": "ii_35411466a031d8ae7f283fc9d0076f96", "metadata": {}, "period": { "start": 1763462590, "end": 1766054540 }, "proration": true, "quantity": 1, "plan": null, "subscription": "sub_423cac7708b84939baf3d4a55b153a19", "subscription_item": "", "type": "" }, { "id": "il_b3c6cf1fb232587229bdf5b8eab56d42", "amount": 9.99, "currency": "USD", "description": "Remaining time on Unlimited Music after 18 Nov 2025", "discountable": false, "invoice_item": "ii_d1fa6c9c886b42a100a511655839d2ea", "metadata": {}, "period": { "start": 1763455774, "end": 1766047667 }, "proration": true, "quantity": 1, "plan": null, "subscription": "sub_e38643c5d8d59f4ccd8ae08f8cc61c8d", "subscription_item": "", "type": "" }, { "id": "il_cb62056ca87c4dc5a4cf5252d48ee65e", "amount": 1050, "currency": "USD", "description": "", "discountable": true, "invoice_item": "ii_9da6c1053ce299a5b926299cab19be7f", "metadata": {}, "period": { "start": 0, "end": 0 }, "proration": false, "quantity": 1, "plan": null, "subscription": "", "subscription_item": "", "type": "" } ], "statement_descriptor": "", "subscription": "", "discount_amount": 0, "subtotal": 1079.98, "tax": 0, "tax_percent": 0, "total": 1079.98, "status": "open", "payout_fields": null, "type": "payment" }, { "id": "invoice_53bcc5366d103e9cf16a8351391fb860", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763514136000, "currency": "USD", "customer": "cus_d3ed65d5091a8398cc3651bcedec1201", "description": "", "discount": null, "due_date": 1766106136000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1764158557000, "period_start": 1763553757000, "lines": [ { "id": "il_d1ce6e1cbc1a381d5ef87c8aa0ae07d6", "amount": 500, "currency": "USD", "description": "SEO", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763553757, "end": 1764158557 }, "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_7e208db5adc9f568011458ad67d75ac0", "subscription_item": "subi_81f05732c05d632981b0c4c05553c3a4", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_7e208db5adc9f568011458ad67d75ac0", "discount_amount": 0, "subtotal": 500, "tax": 0, "tax_percent": 0, "total": 500, "status": "draft", "payout_fields": null, "type": "payment" }, { "id": "invoice_31973661cbf6dc7159a82a714d7aec20", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_create", "created_at": 1763462540000, "currency": "USD", "customer": "cus_4e25112ac20e144ad073a614dc46934b", "description": "", "discount": null, "due_date": 1766054540000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1766054540000, "period_start": 1763462540000, "lines": [ { "id": "il_c37898704011f69416e40fe9c263fb0b", "amount": 9.99, "currency": "USD", "description": "Unlimited Music", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763462540, "end": 1766054540 }, "proration": false, "quantity": 1, "plan": { "id": "plan_7d3521c7b8ddde8f7795c2341a5da819", "aggregate_usage": "sum", "amount": 9.99, "billing_scheme": "per_unit", "created_at": 1763462523, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Unlimited Plan", "tiers": [], "tiers_mode": "", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": true }, "subscription": "sub_423cac7708b84939baf3d4a55b153a19", "subscription_item": "subi_79b1f3f3415ff2e12ec7f4762463ea03", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_423cac7708b84939baf3d4a55b153a19", "discount_amount": 0, "subtotal": 9.99, "tax": 0, "tax_percent": 0, "total": 9.99, "status": "paid", "payout_fields": null, "type": "payment" }, { "id": "invoice_1e692b6c43c9c94d20148ca96c033ccb", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_create", "created_at": 1763455668000, "currency": "USD", "customer": "cus_4e25112ac20e144ad073a614dc46934b", "description": "", "discount": null, "due_date": 1766047668000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1766047667000, "period_start": 1763455667000, "lines": [ { "id": "il_ba3d2d1f2a070402a14d8d86f488663b", "amount": 5, "currency": "USD", "description": "Transit Rides", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763455667, "end": 1766047667 }, "proration": false, "quantity": 1, "plan": { "id": "plan_390625a173f599153b5250715d861718", "aggregate_usage": "sum", "amount": 0, "billing_scheme": "tiered", "created_at": 1756282338, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Transit Use", "tiers": [ { "amount": 4, "up_to": 5, "flat_amount": 1 }, { "amount": 3, "up_to": 10, "flat_amount": 0 }, { "amount": 2, "up_to": 20, "flat_amount": 0 }, { "amount": 1, "up_to": "inf", "flat_amount": 0 } ], "tiers_mode": "graduated", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": true }, "subscription": "sub_e38643c5d8d59f4ccd8ae08f8cc61c8d", "subscription_item": "subi_7987dc3af04f7d0b6ba959e54bba24b7", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_e38643c5d8d59f4ccd8ae08f8cc61c8d", "discount_amount": 0, "subtotal": 5, "tax": 0, "tax_percent": 0, "total": 5, "status": "paid", "payout_fields": null, "type": "payment" }, { "id": "invoice_2f11261204a276e315cc5c2e503764e9", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763427701000, "currency": "USD", "customer": "cus_5bee14584a78638ba717e746be62ee01", "description": "", "discount": null, "due_date": 1766019701000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1764083442000, "period_start": 1763478642000, "lines": [ { "id": "il_3857b5aadc1883e6a6281c8751213062", "amount": 500, "currency": "USD", "description": "SEO", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763478642, "end": 1764083442 }, "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_1f2488cbddd6b5e59feab0937a799797", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763427696000, "currency": "USD", "customer": "cus_5bee14584a78638ba717e746be62ee01", "description": "", "discount": null, "due_date": 1766019696000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1764083488000, "period_start": 1763478688000, "lines": [ { "id": "il_f19758a58849a861da6798c1167afeb0", "amount": 500, "currency": "USD", "description": "SEO", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763478688, "end": 1764083488 }, "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" }, { "id": "invoice_95a86ffe855d3a90a9564bc18f3fef63", "attempt_count": 1, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763254892000, "currency": "USD", "customer": "cus_b306773fc73d23e5a9b4347984606cf7", "description": "", "discount": null, "due_date": 1765846892000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": null, "period_end": 1765891029000, "period_start": 1763299029000, "lines": [ { "id": "il_5c3546e55e89e28bb3b94c523587a757", "amount": 9.99, "currency": "USD", "description": "Unlimited Music", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763299029, "end": 1765891029 }, "proration": false, "quantity": 1, "plan": { "id": "plan_4feb4cf48e807cd142d7759a58a55d2f", "aggregate_usage": "sum", "amount": 9.99, "billing_scheme": "per_unit", "created_at": 1700140529, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Unlimited Plan", "tiers": [], "tiers_mode": "", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 7, "usage_type": "licensed", "active": true }, "subscription": "sub_4fd8fee60b48397e6da57b930c87be49", "subscription_item": "subi_aad30c70e05e34154a7291599225f39a", "type": "subscription" }, { "id": "il_99903bd32f44cfe113c55795088ba594", "amount": 10.99, "currency": "USD", "description": "Unlimited Music", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763299029, "end": 1765891029 }, "proration": false, "quantity": 1, "plan": { "id": "plan_26aabd1d48bcfec1ff05dc2bed772aa3", "aggregate_usage": "sum", "amount": 10.99, "billing_scheme": "per_unit", "created_at": 1700140584, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Unlimited Plan plus", "tiers": [], "tiers_mode": "", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 7, "usage_type": "licensed", "active": true }, "subscription": "sub_4fd8fee60b48397e6da57b930c87be49", "subscription_item": "subi_74a73ee6bd4f536b04cd5675a0dd43fe", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_4fd8fee60b48397e6da57b930c87be49", "discount_amount": 0, "subtotal": 20.98, "tax": 0, "tax_percent": 0, "total": 20.98, "status": "open", "payout_fields": null, "type": "payment" }, { "id": "invoice_1132623799ea95441f74bc8fe94d4423", "attempt_count": 1, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763254884000, "currency": "USD", "customer": "cus_b306773fc73d23e5a9b4347984606cf7", "description": "", "discount": null, "due_date": 1765846884000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": { "error_payment_url": "https://error.example1234.net", "complete_payment_url": "https://complete.example5678.net" }, "period_end": 1765888549000, "period_start": 1763296549000, "lines": [ { "id": "il_9c7abda9f419bb9bb3d699af2ad90d52", "amount": 5, "currency": "USD", "description": "Monthly parking", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763296549, "end": 1765888549 }, "proration": false, "quantity": 1, "plan": { "id": "plan_aa8c4248e0f2a8cdc5f2139a8bf38f10", "aggregate_usage": "sum", "amount": 0, "billing_scheme": "tiered", "created_at": 1698588009, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Transit Use", "tiers": [ { "amount": 4, "up_to": 5, "flat_amount": 1 }, { "amount": 3, "up_to": 10, "flat_amount": 0 }, { "amount": 2, "up_to": 20, "flat_amount": 0 }, { "amount": 1, "up_to": "inf", "flat_amount": 0 } ], "tiers_mode": "graduated", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": true }, "subscription": "sub_717abe89aac9c181f37be618dec744dc", "subscription_item": "subi_d8633f335d60db6fdcf31e205f04b735", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_717abe89aac9c181f37be618dec744dc", "discount_amount": 0, "subtotal": 5, "tax": 0.53, "tax_percent": 10.5, "total": 5.53, "status": "open", "payout_fields": null, "type": "payment" }, { "id": "invoice_b801aeff2744c1d4250e9673cc67d5e9", "attempt_count": 1, "billing": "pay_automatically", "billing_reason": "subscription_cycle", "created_at": 1763254886000, "currency": "USD", "customer": "cus_b306773fc73d23e5a9b4347984606cf7", "description": "", "discount": null, "due_date": 1765846886000, "days_until_due": 0, "metadata": {}, "payment": null, "payout": null, "payment_fields": { "error_payment_url": "https://error.example1234.net", "complete_payment_url": "https://complete.example5678.net" }, "period_end": 1765888614000, "period_start": 1763296614000, "lines": [ { "id": "il_361dc2db35634a8390fd0e45ad374ca2", "amount": 5, "currency": "USD", "description": "Monthly parking", "discountable": true, "invoice_item": "", "metadata": {}, "period": { "start": 1763296614, "end": 1765888614 }, "proration": false, "quantity": 1, "plan": { "id": "plan_aa8c4248e0f2a8cdc5f2139a8bf38f10", "aggregate_usage": "sum", "amount": 0, "billing_scheme": "tiered", "created_at": 1698588009, "currency": "USD", "interval": "month", "interval_count": 1, "metadata": {}, "nickname": "Transit Use", "tiers": [ { "amount": 4, "up_to": 5, "flat_amount": 1 }, { "amount": 3, "up_to": 10, "flat_amount": 0 }, { "amount": 2, "up_to": 20, "flat_amount": 0 }, { "amount": 1, "up_to": "inf", "flat_amount": 0 } ], "tiers_mode": "graduated", "transform_usage": { "divide_by": 1, "round": "up" }, "trial_period_days": 0, "usage_type": "licensed", "active": true }, "subscription": "sub_aa388923118ab61a65dd73bdfa2bd3cd", "subscription_item": "subi_295deb5d5052a237ecaee9663ea0365d", "type": "subscription" } ], "statement_descriptor": "", "subscription": "sub_aa388923118ab61a65dd73bdfa2bd3cd", "discount_amount": 0, "subtotal": 5, "tax": 0.53, "tax_percent": 10.5, "total": 5.53, "status": "open", "payout_fields": null, "type": "payment" } ] }