Skip to content

Instantly share code, notes, and snippets.

Last active January 26, 2018 22:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save iloveitaly/8e6bce2aec361dce38b5c61c48d037ea to your computer and use it in GitHub Desktop.
Create a standalone Stripe invoice to be paid manually (check, wire, etc) using NetSuite and
# Michael Bianco <>
# Description: Create a standalone invoice to be paid manually using NetSuite
# Link:
# Usage:
# gem install stripe
# export STIRPE_KEY=sk_test_123
# ruby create_standalone_manual_invoice.rb
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
customer = Stripe::Customer.create({
description: "Sample customer",
email: ""
# NOTE adding a payment source is omitted here since you are creating a invoice for manual payment
invoice_item = Stripe::InvoiceItem.create({
amount: 50_00,
currency: "usd",
# this description appears on the line item level in NetSuite
description: "A line item",
# NOTE you can specify exactly which NetSuite line item you'd like to connect to
# using metadata. More info:
# metadata: {
# netsuite_service_sale_item_id: 123
# }
# creating this invoice in Stripe will create an open invoice in NetSuite
# if you manually pay the invoice in Netsuite, the payment information is pushed
# back to Stripe and the invoice is marked as paid.
# More information:
invoice = Stripe::Invoice.create(
billing: 'send_invoice',
days_until_due: 30
puts "Stripe Invoice ID #{}"
# NOTE with SuiteSync enabled, the NetSuite invoice ID is added to the Stripe metadata
# shortly after it's created.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment