This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Michael Bianco <mike@suitesync.io> | |
# 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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: <mike@suitesync.io> | |
Description: Maps an ID passed to a custom field on the NetSuite invoice to a | |
class record reference in Netsuite. | |
Link: https://gist.github.com/iloveitaly/da9b88e318025ec53f5bc36ff4dafdcf | |
Installation: | |
1. https://system.netsuite.com/app/common/scripting/uploadScriptFile.nl | |
2. User Event | |
3. Name: Map Custom Field to Class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: <mike@suitesync.io> | |
# Description: batch close old invoices in Stripe | |
# Link: https://gist.github.com/iloveitaly/e3c9eb87aa70f350977c22215304079c | |
require 'stripe' | |
Stripe.api_key = ENV['STRIPE_KEY'] | |
close_invoices_before_date = Date.new(2016, 05, 15).to_time.to_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: <mike@suitesync.io> | |
Description: Modifies data on an "inferred" NetSuite invoice created from a standalone Stripe charge | |
Link: https://gist.github.com/iloveitaly/350363f07b13d7ac81bf81784c1417c9 | |
Installation: | |
1. https://system.sandbox.netsuite.com/app/common/scripting/uploadScriptFile.nl | |
2. User Event | |
3. Name: SuiteSync Inferred Invoice Customization | |
4. ID: _suitesync_inferred_invoice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Michael Bianco <mike@suitesync.io> | |
# Description: An example script demonstrating how to remove customer cards. This | |
# is helpful for keeping a card around temporarily for reauthorizing a | |
# expired card authorization. More information: | |
# https://dashboard.suitesync.io/docs/auth-fulfill-capture#id-like-to-create-an-authorization-for-more-than-7- | |
# Link: https://gist.github.com/iloveitaly/683a4664708ea972ca2e081e55b7c547 | |
# Usage: | |
# | |
# export STRIPE_KEY=sk_test NETSUITE_EMAIL=user@company.com NETSUITE_PASSWORD=password NETSUITE_ACCOUNT= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: <mike@suitesync.io> | |
Description: Generates the Stripe Payment Link for Estimates, or other records in NetSuite | |
Link: | |
Installation: | |
Create Custom Field: | |
1. https://dashboard.suitesync.io/docs/netsuite-configuration#creating-the-stripe-quote-payment-link-custom-field | |
2. Make sure the field has `Store Value` checked and is a free-form text field |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Author: <mike@suitesync.io> | |
Description: Specifies which Stripe account should be used on a transaction based on custom business logic | |
Link: https://gist.github.com/iloveitaly/aced3081f924651891a44c474625976d | |
Installation: | |
Create Custom Field: | |
1. [Customization > Transaction Body Fields > New](https://system.sandbox.netsuite.com/app/common/custom/bodycustfields.nl) | |
2. Create a new field to appear on SalesOrders and Invoices. | |
* Label: "Stripe Account ID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Michael Bianco <mike@suitesync.io> | |
# Description: Use Stripe Subscriptions to create a payment plan against a single NetSuite Invoice | |
# Link: | |
# Usage: | |
# | |
# export STRIPE_KEY=sk_test NETSUITE_EMAIL= NETSUITE_PASSWORD= NETSUITE_ACCOUNT= | |
# gem install stripe netsuite | |
# ruby stripe_payment_plan_with_subscriptions.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function log(msg) { | |
nlapiLogExecution('DEBUG', msg); | |
} | |
function startsWith(str, searchString) { | |
return str.indexOf(searchString) === 0; | |
} | |
function isEmpty(obj) { | |
return obj === undefined || obj === null || obj === ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_url_with_redirects(url) | |
response = nil | |
loop do | |
response = HTTPI.get(url) | |
break if response.code != 302 | |
url = response.headers['location'] | |
end |