Retrieve Invoice Lines from Upcoming Invoice
Retrieve invoice lines from the upcoming invoice for a customer.
If a customer has more than one subscription, this method retrieves the invoice lines of the invoice that is due first.
Note
This method is relevant to invoices that are automatically generated out of subscriptions.
customer
ID of the customer whose invoice you want to retrieve.
currency
Three-letter ISO 4217 code for the currency. Required when the invoice is not linked to a specific subscription.
Code Samples
.NET
using System; namespace RapydApiRequestSample { class Program { static void Main(string[] args) { try { string customer = "cus_478a0ffb8ad771c1bf9736e4b9e2b5f1"; string currency = "USD"; string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $"/v1/invoices/upcoming/lines?customer={customer}¤cy={currency}"); 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/upcoming/lines?customer=cus_478a0ffb8ad771c1bf9736e4b9e2b5f1¤cy=USD' ); 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/upcoming/cus_478a0ffb8ad771c1bf9736e4b9e2b5f1/lines?currency=USD"); 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/upcoming/lines?customer=cus_478a0ffb8ad771c1bf9736e4b9e2b5f1¤cy=USD') pprint(result)
/v1/invoices/upcoming/lines
Retrieve Invoice Lines from Upcoming Invoice for Customer
curl -X get https://sandboxapi.rapyd.net/v1/invoices/upcoming/lines?customer=cus_478a0ffb8ad771c1bf9736e4b9e2b5f1¤cy=USD -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": "49217058-15b8-4508-9980-5879b2ef7e24" }, "data": [ { "id": "il_be8ce2e5800cabfd4fb47988eedc69e4", "amount": 10, "currency": "USD", "description": "", "discountable": false, "invoice_item": "ii_7ea5a3486bf35b31baaba6a809a7e31d", "metadata": {}, "period": { "start": 0, "end": 0 }, "proration": false, "quantity": 0, "plan": { "transform_usage": {} }, "subscription": "", "subscription_item": "", "type": "" }, { "id": "il_9b154075a61930c84875ac2ad32e3f1e", "amount": 10, "currency": "USD", "description": "", "discountable": true, "invoice_item": "ii_fa1b4733202907facf84435f7040b5e4", "metadata": { "merchant_defined": true }, "period": { "start": 0, "end": 0 }, "proration": false, "quantity": 0, "plan": { "transform_usage": {} }, "subscription": "", "subscription_item": "", "type": "" } ] }