View stripe_create_subscription_with_failed_invoice_payment.rb
# Author: Mike <mike@suitesync.io>
require 'stripe'
Stripe.api_key = ENV['STRIPE_TEST_KEY']
def create_plan(amount: 20_00)
Stripe::Plan.create(
:amount => amount,
:interval => 'month',
View link_netsuite_customer_to_stripe_customer.rb
View pay_due_netsuite_invoices_with_stripe.rb
# Author: <mike@suitesync.io>
require 'stripe'
require 'netsuite'
Stripe.api_key = ENV['STRIPE_KEY']
NetSuite.configure do
reset!
View pay_netsuite_invoices_for_customer.rb
# Author: <mike@suitesync.io>
# Description: Demonstrates pulling open invoices from NetSuite for a customer, and paying them off with Stripe.
# requires the following environment variables:
#
# STRIPE_KEY
# NETSUITE_EMAIL
# NETSUITE_PASSWORD
# NETSUITE_ACCOUNT
View reauthorize_expired_uncaptured_stripe_charge.rb
# Author: <mike@suitesync.io>
# Description: Create a "fresh" charge when a uncaptured Stripe charge expires (i.e. is 7 days past the original authorization date)
# Resources:
# - https://support.stripe.com/questions/does-stripe-support-authorize-and-capture
# - https://stripe.com/blog/auth-capture
require 'stripe'
@token = 'sk_test_'
View apply_stripe_charge_to_netsuite_invoice.rb
# Michael Bianco <mike@suitesync.io>
# Description: Boilerplate implementing linking Stripe Charges to NetSuite Invoices
# Documentation: Reach out to SuiteSync for additional documentation!
# requires the following environment variables:
#
# STRIPE_KEY
# NETSUITE_EMAIL
# NETSUITE_PASSWORD
View copy_stripe_object_metadata_using_webhooks.rb
# Mike Bianco <mike@suitesync.io>
# Description: Example of using Stripe webhooks to copy a parent subscription
# metadata field to a Stripe-generated charge's metadata
require 'stripe'
require 'sinatra'
Stripe.api_key = "sk_test_"
View match_stripe_customers_to_netsuite.rb
# Mike Bianco <mike@suitesync.io>
# Description: Script to link Stripe customers to NetSuite customers using email as the primary key
# requires the following environment variables:
#
# STRIPE_KEY
# NETSUITE_EMAIL
# NETSUITE_PASSWORD
# NETSUITE_ACCOUNT
View cangaroo_order_job.rb
module Mandrill
class OrderJob < Cangaroo::Job
include Rollbar::ActiveJob
connection :mandrill
path '/orders'
def perform?
type == 'orders' &&
View find_closed_stripe_invoices.rb
# Mike Bianco <mike@suitesync.io>
require 'stripe'
Stripe.api_key = 'sk_live_123'
def find_closed_invoices
limit = 2000
invoices = []
created_after = Date.new(2016,05,15)