Stripe to NetSuite Charges Import

Overview

This integration syncs Stripe charges into NetSuite through PayPack. For each eligible charge, PayPack finds or creates the NetSuite customer and creates a Cash Sale, Customer Deposit or Customer Payment, depending on how you configure the flow.

All import modes use the same PayPack configuration and field mappings, so results are consistent however a charge is imported. Every run is logged for troubleshooting (see Logging).

Charges that belong to a Stripe invoice are not imported here. They are handled by the Stripe to NetSuite Invoice Import.

Import Modes

Mode Trigger Best for
Batch Scheduled script Ongoing, incremental sync
On-Demand Manual, by Stripe charge ID Importing missing charges

Configuration Settings

All charge settings are located under the Charges subtab within the Data Orchestration tab. In this subtab, the Charges and Customer Settings field groups contain all configuration fields required for managing the Charges flow.

Note: Click any field label in the Charges and Customer Settings field groups to see a description of its purpose and usage.

 

Field Descriptions

  • Enable Charges Flow: Check/mark to enable importing Stripe charges into NetSuite. Uncheck to stop all charge imports.enable charges.jpg 
  • Update Stripe Charge Metadata: Check/mark to automatically write the NetSuite Selected Transaction Record’s Internal ID back to the corresponding Stripe charge after it is created.charges - update stripe charge metadata.jpg

  • Last Exported Date: Shows the last time charges were imported from Stripe (in Unix timestamp). This value is used in the next import to fetch only charges created after this time using the created[gte] parameter.
    Note: The system updates this field after every flow execution, and it is read-only.charges - last exported date.jpg 

  • Stripe Charge Status Filter (Applied after retrieval): Stripe charges with status Succeeded are imported. This field specifies which charge status is allowed for processing after retrieval, ensuring that only Succeeded charges are synced to NetSuite.
    Note: The value is set to Succeeded and is read-only.charges - filter.jpg 

  • Transaction Type: Determines which NetSuite transaction type is created for each imported Stripe charge. Choose from Cash Sale, Customer Payment, or Customer Deposit based on your accounting workflow. A transaction type must be selected. Without one, charges cannot be processed.charges -transaction type.jpg

  • Transaction Field Mappings: Controls how Stripe Charge fields are mapped to NetSuite transaction fields (Cash Sale, Customer Payment, or Customer Deposit) and allows you to include related customer data from the associated Stripe customer.
    Note: Fields from the Stripe charge object can be used. Associated customer data is available via stripeCustomerData (e.g., stripeCustomerData.id, stripeCustomerData.email).
    The NetSuite Customer record ID is available as nsCustomerId and can be used to link the transaction to the corresponding NetSuite customer. 
    Refer to the Sample Field Mappings section for guidance on linking the NetSuite Customer Record ID. charges -transaction field mappings.jpg

  • Payment Account: Select the NetSuite account where Stripe payments will be recorded. All imported payments are posted to this account.charges - payment account.jpg

  • Payment Method: Select the payment method in NetSuite for recording Stripe payments.
    Note: To use condition-based mapping, leave the Payment Account and Payment Method fields empty and use static or dynamic mapping. Filling in these fields sets a global default that overrides any conditional logic in the Transaction Field Mappings.
    Refer to the Field Mapping Documentation for examples and detailed instructions on implementing conditional mappings.charges - payment method.jpg 

  • Customer Field Mappings: Controls how Stripe Customer fields are mapped to NetSuite Customer fields
    Note: Only fields from the Stripe customer object can be used.charges - customer field mappings.jpg 

  • Criteria to find existing customer record: Defines a lookup that determines whether the customer already exists in NetSuite. If the lookup finds nothing, a default value can be provided by specifying a default NetSuite customer internal ID. If no criteria are provided, the flow finds an existing customer using the Stripe Customer ID (PayPack) field or email. Criteria can combine one or more filters with AND/OR logic.charges - customer criteria.jpg

In the sample lookup below, metadata.cus_email is a property on the Stripe Charge object

{
  "filters": [
    [
      "comments",
      "is",
      "{{metadata.cus_email}}"
    ]
  ],
  "default": ""
}

How the Import Works

Batch and On-Demand imports follow the same steps.

1. Get charges

  • Charges are fetched from the Stripe API.
    • Batch: only charges created on or after the Last Exported Date.
    • On-Demand: only the Stripe charge IDs you specify on the deployment.
  • Charges already in NetSuite are skipped, using the Stripe Charge Id (PayPack) field on the Cash Sale, Customer Payment or Customer Deposit.
  • Only charges with status succeeded and captured = true are processed.
  • Charges linked to a Stripe invoice through a payment intent are skipped. The Invoice import handles those.

2. Record and evaluate the charge status

  • For every charge not already in NetSuite and not linked to an invoice, PayPack creates a PayPack Stripe Charge Status custom record, so every incoming charge is tracked whether or not it is eligible yet.
  • If the charge is succeeded and captured, it moves on to customer and transaction creation.
  • If it is not captured or not succeeded, it is not processed further for now. The custom record keeps it on file, and it is re-checked later (see Processing Pending Charges).

3. Check the transaction type

  • PayPack reads the Transaction Type from your configuration. If none is set, the charge cannot be processed.

4. Get the customer

  • The customer is fetched from Stripe using the Stripe Customer ID on the charge.

5. Find or create the NetSuite customer

  • PayPack uses the Criteria to find existing customer record. If no criteria are set, it matches on Stripe Customer ID or email.
  • Match found: the existing customer is used. If its Stripe Customer ID field is blank, PayPack fills it in. This happens only when Customer Field Mappings are configured for the Charges flow and a default (hardcoded) customer is not in use.
  • Match found, different subsidiary: the subsidiary is added to the customer's Subsidiaries tab, and a multi-subsidiary custom record is created.
  • No match: the default customer is used if one is configured. Otherwise a new customer is created from the Customer Field Mappings.
  • If a default customer is used, the existing customer record and its Stripe Customer ID field are not updated.

6. Create the NetSuite transaction

  • PayPack creates the selected transaction (Cash Sale, Customer Payment or Customer Deposit) with your mapped fields, including payment method and payment account.
  • If mapped, the Stripe Charge ID is stored in the Stripe Charge ID (PayPack) field on the transaction.
  • Each created or skipped charge is logged in the PayPack Flow Record Log.

7. Update Stripe metadata

  • The NetSuite record ID is written back to the Stripe charge, using a metadata key that matches the transaction type.
  • Skipped if Update Stripe Charge Metadata is not checked.

Processing Pending Charges

This process (part of the Stripe Charges to NetSuite flow)  identifies and evaluates pending Stripe charges stored in NetSuite, ensuring only finalized transactions move forward for processing.

1. Retrieve Pending Charge Records

The Stripe Charges to NetSuite flow pulls PayPack Stripe Charges Status custom records using a configured saved search:

  • Saved Search Name: PayPack Stripe Charges Record Search
  • Criteria:
    • Captured = false and Stripe Payment Intent Status ≠ canceled → payment still in progress
    • Captured = true and Stripe Charge Status = pending → charge not yet finalized

These records represent charges that are not yet eligible for processing.

2. Fetch Latest Charge Data from Stripe

For each pending record, the system retrieves the most up-to-date charge details from Stripe.

  • Uses the stored Stripe Charge ID
  • Retrieves associated Stripe Customer data, if available and attaches it to the charge

3. Evaluate Charge Eligibility

Each charge is assessed using the latest Stripe data:

  • Eligible for processing:
    • Status = succeeded
    • Captured = true
  • Not eligible:
    • Charges that do not meet the above conditions remain in a pending state and are re-evaluated in future runs

Script Details

Batch (Map/Reduce)

Script: PayPack S2NS Charges Import MR Batch. Runs on a schedule you define.

  • First run: fetches charges created on or after the Charge Start Date. Later runs fetch only charges created after the Last Exported Date, so nothing is imported twice.
  • Parameters:
    • Stripe Account Id (custscript_pp_stripe_chr_account_id): internal ID of the PayPack Stripe Account Configuration record.
    • Charge Start Date (custscript_pp_charge_start_date): used only on the first run, or when no Last Exported Date exists. Enter a Unix timestamp in seconds, for example 1761147332. The Last Exported Date is updated automatically when a run completes.

On-Demand (Map/Reduce)

Script: PayPack S2NS Charges Import MR OnDemand. Runs only when you trigger it. Use it mainly to import missing charges.

  • Parameters:
    • Stripe Account Id (custscript_pp_stripe_od_chr_account_id): internal ID of the PayPack Stripe Account Configuration record.
    • Stripe Charge IDs (custscript_pp_od_stripe_charge_ids): comma-separated list of the Stripe charges to import.

Deploying and Scheduling

  1. Go to Customization > Scripting > Scripts.
  2. Filter by Type: Map/Reduce and open the Batch or On-Demand script.
  3. Click Deploy Script.
  4. On the deployment, set the Stripe Account Id parameter to the internal ID of the relevant PayPack Stripe Account Configuration record.
  5. Batch: on the Schedule subtab, choose the event type (single, daily, weekly, monthly or yearly), start and end dates (or No End Date), and the repeat interval. Click Save.
  6. On-Demand: enter the charge IDs and use Save and Execute.

Sample Field Mappings

IDs below are placeholders. Replace them with your own values.

Sample Cash Sale Field Mappings


Sample Cash Sale Field Mappings
{
  "fields": [
    { "generate": "entity", "extract": "nsCustomerId" },
    { "generate": "location", "hardCodedValue": "<LOCATION_ID>" },
    { "generate": "custbody_nm_stripe_dcharge_id", "extract": "id" }
  ],
  "sublist": {
    "item": [
      { "generate": "item", "hardCodedValue": "<ITEM_ID>" },
      { "generate": "quantity", "hardCodedValue": "1" },
      { "generate": "price", "hardCodedValue": "-1" },
      { "generate": "amount", "handlebars": "{{toFixed (divide amount 100) 2}}" },
      { "generate": "taxcode", "hardCodedValue": "<TAX_CODE_ID>" }
    ]
  }
}

 


Sample Customer Payment Field Mappings

{
  "fields": [
    { "generate": "customer", "extract": "nsCustomerId" },
    { "generate": "payment", "handlebars": "{{toFixed (divide amount 100) 2}}" },
    { "generate": "paymentmethod", "hardCodedValue": "<PAYMENT_METHOD_ID>" },
    { "generate": "account", "hardCodedValue": "<ACCOUNT_ID>" },
    { "generate": "custbody_nm_stripe_dcharge_id", "extract": "id" }
  ]
}

 


Sample Customer Deposit Field Mappings

{
  "fields": [
    { "generate": "customer", "extract": "nsCustomerId" },
    { "generate": "payment", "handlebars": "{{toFixed (divide amount 100) 2}}" },
    { "generate": "location", "hardCodedValue": "<LOCATION_ID>" },
    { "generate": "paymentmethod", "hardCodedValue": "<PAYMENT_METHOD_ID>" },
    { "generate": "account", "hardCodedValue": "<ACCOUNT_ID>" },
    { "generate": "custbody_nm_stripe_dcharge_id", "extract": "id" }
  ]
}


 

Was this article helpful?
0 out of 0 found this helpful

More resources