Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iloveitaly/da61ee64a00f4e2198895b28c4b0d33a to your computer and use it in GitHub Desktop.
Save iloveitaly/da61ee64a00f4e2198895b28c4b0d33a to your computer and use it in GitHub Desktop.
Use a standalone Stripe payment to create an invoice in NetSuite with custom data http://SuiteSync.io/
# Michael Bianco <mike@suitesync.io>
# Description: Use a standalone payment to create an invoice in NetSuite with customized metadata
# https://dashboard.suitesync.io/docs/standalone-charges
# Link:
#
# Usage:
#
# export STRIPE_KEY=sk_test
# gem install stripe netsuite
# ruby create_standalone_payment_with_custom_metadata.rb
require 'stripe'
Stripe.api_key = ENV['STRIPE_KEY']
Stripe::Charge.create(
currency: 'usd',
amount: 100_00,
source: 'tok_visa',
description: "Order #123 from Fred",
metadata: {
# https://dashboard.suitesync.io/docs/standalone-charges#custom-netsuite-items-with-standalone-charges
netsuite_product_name: "identifer_of_netsuite_product"
# additional fields on the NetSuite invoice or NetSuite customer payment
# metadata fields can be mapped to whatever NetSuite field (on the invoice or customer payment) you'd like
# drop-downs needs to be specified using a NS internal ID: https://dashboard.suitesync.io/docs/field-customization#field-types
netsuite_department_id: 123
netsuite_class_id: 234,
# free form text can just be passed along
netsuite_custom_field_data: "Some data for a custom NetSuite field"
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment