Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create a Stripe invoice with a custom revenue recognition schedule.
# Michael Bianco <>
# Description: Create a Stripe invoice with a custom rev rec schedule
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
customer = Stripe::Customer.create
customer.sources.create(card: 'tok_visa')
invoice_item = Stripe::InvoiceItem.create({
amount: 10_00,
currency: "usd",
description: "123 units of component at 0.25",
metadata: {
netsuite_product_name: "component",
# if the line item represents tax on the order, this flag must be specified
netsuite_tax: true,
# if the items have a revenue schedule it needs to be specified via two fields
# dates needs to be formatted in UTC0 as a unix timestamp
netsuite_rev_rec_start_date: - (60 * 60 * 24 * 30),
invoice = Stripe::Invoice.create({
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment