Retrieve Upcoming Invoice
Retrieve a preview of the basic data of the upcoming invoice for a customer, with individual invoice lines.
To get the invoice lines of the invoice, use Retrieve Invoice Lines from Invoice.
The response generated cannot be used to generate a payment authorization.
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?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?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/cus_478a0ffb8ad771c1bf9736e4b9e2b5f1/upcoming?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?customer=cus_478a0ffb8ad771c1bf9736e4b9e2b5f1¤cy=USD') pprint(result)
/v1/invoices/upcoming
Retrieve Upcoming Invoice for Customer
curl -X get https://sandboxapi.rapyd.net/v1/invoices/upcoming?customer=cus_4ed89a9c556fb200997e974f75895dc9¤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": "1963a94b-5d94-49c7-950f-9610fe258fdc" }, "data": { "id": "invoice_fd4545925e5a91119bb2aa935d0ff607", "attempt_count": 0, "billing": "pay_automatically", "billing_reason": "upcoming", "created_at": 1702208338, "currency": "USD", "customer": "cus_4ed89a9c556fb200997e974f75895dc9", "description": "", "discount": null, "due_date": 1704800338, "days_until_due": 30, "metadata": null, "number": 0, "payment_method": null, "payment": null, "payout": null, "payment_fields": null, "period_end": 0, "period_start": 0, "lines": [], "statement_descriptor": "", "subscription": null, "discount_amount": 0, "subtotal": 0, "tax": 0, "tax_percent": 0, "total": 0, "status": "draft", "payout_fields": null, "type": "payment", "next_payment_attempt": 1702211938, "automatic_attempt_count": null } }