Here are some examples to help you integrate your application with Stripe to use the NetSuite integration.

The code examples below are designed to provide boilerplate code to demonstrate how the Stripe NetSuite integration works, and how to handle unique business processes using the integration. All of the examples will run as-in against your Stripe test environment.

To run any of the examples:

  1. Install the stripe ruby gem. The example code can easily be ported to other languages.
  2. Replace the test key in the source files with your Stripe account's test key.
  3. Run ruby the_example.rb at the terminal

Creating a NetSuite Customer with Stripe

This example demonstrates this customer translation functionality:

  • Linking an existing NetSuite customer with an existing customer
  • Linking an existing NetSuite customer with a new customer
  • Using metadata to set NetSuite field data

View Example Code

Paying a NetSuite Invoice with Stripe

You can pay an existing NetSuite invoice with Stripe by passing the NetSuite Invoice ID to Stripe. The integration applies a CustomerPayment against the invoice you specify.

View Example Code

Attaching a Stripe Charge as a CustomerDeposit against a SalesOrder

You can attach a Stripe charge against a SalesOrder as a customer deposit by specifying the internal ID of the SalesOrder.

View Example Code

Creating a Standalone Invoice with Stripe

The integration supports translating subscription-created invoices with revenue recognition, but it also supports translating one-off invoices creating in Stripe. This example demonstrates how to create a customer and a standalone invoice with a custom SKU.

If Stripe's subscription billing isn't workable for your use-case, but you want to use the Stripe NetSuite integration to create invoices in NetSuite, creating a standalone invoice might work for you.

View Example Code

Collecting Payment for a Standalone Payment with Stripe Checkout

This example demonstrates how to use Stripe Checkout to collect payment credentials, and then create a Stripe Invoice and Charge the collected credit card.

View Example Code

Testing Stripe dispute integration

The integration fully supports handling credit card disputes. Here's an example which creates a dispute in your test account to demonstrate how the integration handles disputes.

View Example Code

ACH-in & Bitcoin Payments

ACH-in and Bitcoin charges are fully supported in the integration. This example will create a bitcoin payments in your Stripe test environment to allow you to inspect the resulting customer payment in NetSuite.

View Example Code

Creating Sales Orders with Stripe Orders API (Relay)

This example demonstrates how the integration's order integration works:

  • Creates a SKU, which is translated into a NonInventoryItem in NetSuite
  • Creates a Order with a single line item
  • Waits for the translation to complete, and returns the NetSuite SalesOrder internal ID.

View Example Code

Copy Stripe Subscription Metadata to Subscription Invoice Metadata

Stripe Subscriptions create a Stripe Invoice every plan period. In some cases, copying metadata from the subscription to the invoice is helpful for setting standard or custom fields on the invoice. For instance, if there's an internal subscription order number that you want on every subsequent invoice, you can copy this number from the subscription metadata to the invoice metadata so the number can flow to the NetSuite invoice.

View Example Code

Link Stripe Customers to NetSuite Customers

If you've been using NetSuite for a while, but are just getting started with Stripe, you'll want to link your Stripe customers to the associated NetSuite customer. Here's an example of linking Stripe customers with NetSuite customers by using email as the linking key between the two systems:

View Example Code

Pay Due NetSuite Invoices Using Stripe

You can leverage SuiteSync to auto-pay invoices in NetSuite using Stripe. SuiteSync has built-in functionality to handle this, but you can also customize the example code below to fit your exact use-case.

View Example Code

Find Closed and Unpaid, or Forgiven Invoices

If you choose not to automatically close out unpaid or forgiven Stripe invoices in NetSuite, you will want to create a custom process around handled this "bad debt". Here's a starting point you can use to pull identify these invoices in Stripe.

View Example Code