# Set up the NetSuite-Initiated Refunds workflow

Learn how to configure the NetSuite-Initiated Refunds workflow in the Stripe Connector for NetSuite (SCN).





> If you’re migrating from SuiteSync to Stripe Connector for NetSuite, use the [migration instructions](https://docs.stripe.com/use-stripe-apps/netsuite/migration/netsuite-initiated-refunds.md).

The Stripe Connector for NetSuite supports the NetSuite-Initiated Refunds workflow. When you use the Stripe Connector Add-ons bundle ID `502910`, both the bundle’s saved search and SuiteScript search for and act on credit memos, customer refunds, or cash refunds that were created in NetSuite. All functionality is prebuilt and relies on you creating these refund-related records in NetSuite.





## Configure the NetSuite-Initiated Refunds saved search and script deployment

1. [Installing the Add-ons bundle](https://docs.stripe.com/use-stripe-apps/netsuite/stripe-connector-add-ons.md) automatically creates a **Stripe** [Custom Center](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N2890512.html) tab in the colored bar on any NetSuite page. If you don’t see it, click the overflow menu (⋯), which might also be hidden behind floating NetSuite elements.

2. Hover over the Stripe tab in the colored bar on any NetSuite page.

3. Go to **Stripe** > **Add-ons** > **Manage Add-ons**.

4. On the subtabs bar, click **Stripe Add-ons**.

5. On either the **Inactive** or **Active** subtab, locate **NetSuite-Initiated Refunds**.

6. In the **NetSuite-Initiated Refunds** row, click **Show More** and read the technical feature description.

7. You can also change the settings for the `User Event script` by clicking the link.

8. Click the saved search link for the **Stripe Add-on NetSuite-Initiated Refunds Template** to open the saved search template.

9. Edit the `Type` criteria values based on the record types you want the workflow to act on. The following table shows which NetSuite record types you can enable for this workflow.

   

   

| NetSuite record type | Common use case                                                                                                                                                                                                                             |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Credit Memos**     | Create a credit memo from a NetSuite invoice that was originally paid by Stripe. The workflow creates a Stripe refund against the original charge and then creates and links a NetSuite customer refund applied to the credit memo.         |
| **Customer Refunds** | If the customer payment isn’t applied to any invoice, create a customer refund from it. The workflow creates a Stripe refund against the original charge and links it back to the customer refund.                                          |
| **Cash Refunds**     | If you’re creating cash sales in NetSuite and linking them to Stripe charges with metadata, create a cash refund from the cash sale. The workflow creates a Stripe refund against the original charge and links it back to the cash refund. |

   

   

10. To narrow down the search results beyond `Type`, you can add additional criteria.

11. Don’t delete any of these criteria rows, which are required for the feature to function correctly:

    - `Main Line: true`
    - `Stripe Last Modified (Custom Body): is empty`
    - `Refund via Stripe (Custom Body): is true`
    - `Memo: does not contain Stripe Add-on Error`

12. Change the name of the saved search to remove `template` and optionally add another identifier, then click **Save As**. Make note of the name so you can find it later.

13. On the NetSuite page, go to **Stripe** > **Add-ons** > **Manage Add-ons**.

14. In the **NetSuite-Initiated Refunds** row, click **View**.

15. On the **Script Deployment** page, click **Edit**.

16. Configure the **Schedule** subtab as needed.

    The script can run as frequently as every 15 minutes, daily. To use this option, you must also configure the `Start Time` to 12:00 AM (00:00). If you configure a different time, the script only runs every 15 minutes starting at that time, until the end of the specific day at 11:45 PM (23:45).

    You can also set the schedule to `Single Event`, which you can use for testing or manually running one-time batches.

17. On the **Parameters** subtab, set the `Records to Process Search` to the newly named saved search you created previously.

18. Set the `Stripe Account` field if you want to use one Stripe account when the script deployment runs. Otherwise, you can leave this blank.

    You can see this dropdown on the following records: NetSuite account, Script Deployment page, subsidiary records, customer records, and transaction records. Select the record type in the hierarchy to associate with the Stripe account.

    If needed, you can edit the other record to configure the Stripe account.

    > The dropdown lists all the available Stripe account custom records that you created during the [Stripe Connector Add-ons bundle installation](https://docs.stripe.com/use-stripe-apps/netsuite/stripe-connector-add-ons.md). You can create additional Stripe account records in a separate browser tab.

19. Click **Save** if you don’t want to deploy the script now. Otherwise, continue to the next step.

## Deploy the script

1. Confirm your deployment timing:

   - In a NetSuite sandbox, you can deploy the script on a schedule or as a single event.

   

   

   - In a NetSuite production environment, you must carefully time the script deployment to prevent unintended behavior. This step in the process is the final trigger for the workflow to function.

   

2. On the **Script Deployment** page, configure the following:

   - Set the **Status** to `Testing` or `Scheduled`.
   - Select the **Deployed** checkbox when you want the deployment to be live.

   > In NetSuite production, clear **Test Mode** only when this deployment connects to a live mode Stripe account. Keep it selected for a Stripe sandbox or a legacy test mode sandbox so the script uses the test API key.

3. Click **Save**.

## Validate the script functionality

1. Confirm that at least one record meets the saved search criteria, as configured in the previous steps.

   

   

   If you’re in a test environment, you can create an automated test:

   - Find a NetSuite payment record that was originally created or linked by SCN. For example, you can use a customer payment that’s applied to a NetSuite invoice. Stripe can’t refund a payment it didn’t originally create.
   - Make sure the record has **Refund via Stripe** selected.
   - Create a related test refund record in NetSuite, based on the types you configured. For example, credit memo, customer refund, or cash refund.

   

   

2. Confirm the script is running:

   - If you configured a schedule and deployed the Script Deployment, the script now runs on that schedule.
   - If you configured a single event, go to the Script Deployment page and click **Edit**. Select **Save and Execute** from the dropdown next to the **Save** button.

3. After the script runs, go to the corresponding customer or payment in the Stripe Dashboard and verify the refund was created in Stripe.

4. If the scenario requires the SCN App to create a second record in NetSuite, verify that it was created. For example, if you create a credit memo that’s processed by the script, the SCN App creates a corresponding customer refund within a few minutes of the script running.





## See also

- [Troubleshooting](https://docs.stripe.com/use-stripe-apps/netsuite/error-resolution.md)


