---
title: Sandbox Best Practices
slug: payments/sandbox-best-practices
description: Follow sandbox best practices in Unaric Payments to test new features safely before deploying to production.
docTags: 
createdAt: 2025-02-13T02:50:47.586Z
---

## Define sandbox template 

Sandbox templates allow us to pick specific objects and data to copy to our Full or Partial Copy sandbox to control the size and content of each sandbox. Sandbox templates are only available for use with Full or Partial Copy sandboxes. We can select the object data (standard and custom) to copy during the creation or refresh of a sandbox. Below are the steps to create sandbox template-

1. Go to **Setup > Environments > Sandbox**.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfAx_x0T3v8txk-ujzfG_54XUFiEGqbnWAeeh4htcs2JFA3PnoUuFwRUj7R-hmbRSPvC2wSdNhYe-w2FYF_3mOqLyPEWawvGgORfXw1Uankn5DFqwuoqUSQSBwzSKwEXGviTHdm4VgTgXvik2iHSXa8UzM?key=16GuHjp6iW6Cc56zD5v2qQ" size="66" width="551" height="260" position="center" darkWidth="551" darkHeight="260" showCaption="false"}
2. Click the **Sandbox Templates** tab.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcsgzobrHwOHPxJQ6QSaf07cuj0XACGDj8RjHXz3Se2sC_DLwq7lXC48cK90tUf2lfML8dH_UQsnM0dSOiKNtJy3yDImUg7dozN3c-KRWu6WebCyN23D2cFH57amR8c5ucnl9xZANMZlOa0YqcO0pb4V6E?key=16GuHjp6iW6Cc56zD5v2qQ" size="66" width="310" height="92" position="center" darkWidth="310" darkHeight="92" showCaption="false"}
3. Click **New Sandbox Template** or **Edit** next to an existing template you want to modify.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcyI2jz9tjCKaOCpWypS0guM1reoS_q-bBHWAGzpRJYX_w3MUluHgqHRpu7vibGKdWAQcQlF9iysTIt1AMMgD-Fx22YiPX9iZ1L2_uXRLUWWBJmF87Ju7daiCbwzxbUtblMCCK0PYnXtb9tqjYaiTbcjSY?key=16GuHjp6iW6Cc56zD5v2qQ" size="68" width="630" height="90" position="center" darkWidth="630" darkHeight="90" showCaption="false"}
4. Enter a name and description for the sandbox template.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXc7BZRWU9JGGKvpMT3zEgX02cn3eR_SFJJtpG1990qi1Z5VLoID17fJr_xf1clQ9kb-rIGE8ItDHKFrC4EcZFKzXC1SjsjFNOe0exNiclE4wNlgCvvZ_t_hjt5WtbdNw2b6LsS8Jgdf1dtY6C85e7-XFIs?key=16GuHjp6iW6Cc56zD5v2qQ" size="72" width="728" height="164" position="center" darkWidth="728" darkHeight="164" showCaption="false"}
5. Select the checkbox for each object you want from the available Objects list

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXcm7zY-ecckMC8-yunoQx-7TI2kZPY2m8lLPZIRAUNy3wP-W93dDG1xPIPjn4Pl2IDW11IstMgeBgVCxVnGb5DEOVF2JpUMNtVrtXljh6aYWMrANozxyPf-vQiouj2uO6tzo_1r0cfRSziytf5wORU_2jQ?key=16GuHjp6iW6Cc56zD5v2qQ" size="72" width="465" height="158" position="center" darkWidth="465" darkHeight="158" showCaption="false"}
6. Click **Save**.
7. Select this template to specify the data during sandbox refresh.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXf8UfHgngvEt879B9yyhrnZ5F8d563YClTzEFVCWZ56nCctWIva84q_2niUHXABB0b9ctqwBmAiW9IehKt6XsQGcnYAjS7Ry15mE0iR4dYeJ_mNznBjs75oE0GTm_SlvJg7jVHjEKm8Ulrry-uRbpw4JOw?key=16GuHjp6iW6Cc56zD5v2qQ" size="54" width="380" height="150" position="center" darkWidth="380" darkHeight="150" showCaption="false"}



## Use Unaric Payments Sandbox class while refreshing sandbox from production

Payments provides a class that automates data manipulation of Payments connections to make your sandbox environment business-ready. This class which run scripts after each creation and refreshes for this sandbox while refreshing the sandbox from production. To use this class:

1. Go to **Setup > Sandboxes**.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfAx_x0T3v8txk-ujzfG_54XUFiEGqbnWAeeh4htcs2JFA3PnoUuFwRUj7R-hmbRSPvC2wSdNhYe-w2FYF_3mOqLyPEWawvGgORfXw1Uankn5DFqwuoqUSQSBwzSKwEXGviTHdm4VgTgXvik2iHSXa8UzM?key=16GuHjp6iW6Cc56zD5v2qQ" size="76" width="551" height="260" position="center" darkWidth="551" darkHeight="260" showCaption="false"}
2. Click on the **Refresh** link for the sandbox you want to refresh.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXevBws9uI_3NbtkxpJojwxpQDZ4vAYsjzfKakzc3wGir90O-j_j4FUhfW86Z3d29PRXF6qDji7UVFogjU2qo1ZIoYSI0Uf_E6mvExybAr4ckBVg0nT3mfxrIhJM4pbgLmCxykWDGOnKcEAupscFCYsgvWU?key=16GuHjp6iW6Cc56zD5v2qQ" size="50" width="177" height="138" position="center" darkWidth="177" darkHeight="138" showCaption="false"}
3. Click **Next** for the type of sandbox you have selected in the last step.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXfloFRb-Rtu7Z5cS9ut68LSI6vhmQQvCyxzdc76iPPXMIsnYCqLums-JZs2a2WbG7wIC22PbcpZ6KbO3_q3OrZtElZQ4MYNKlba9GmHyr4rS0ekZ4ViGhy-4yFWnVwzUAGzP7yko7-i0FDv6LMls2xzMhc?key=16GuHjp6iW6Cc56zD5v2qQ" size="98" width="796" height="444" position="center" darkWidth="796" darkHeight="444" showCaption="false"}
4. Add the Apex class name as *Sandbox* and click **Create** to finish. On Sandbox refresh the Unaric Payments sandbox class executes a script which will automatically amend the Unaric Payments settings from the sandbox.

   ::Image[]{src="https://lh7-rt.googleusercontent.com/docsz/AD_4nXdJHBl_UO1Lyd_u4N6NobaYhaMJ8Z95yczi5ODoCyooseHiCPy58hfQnbij31l0BRdem6dlqJyhDnzyqqatZ-VRC9dFRheReTUNb_9YBqmhVIvfv_cXjHdMLG49xxipiaK_cX8OBvv8VNWZv7YhkDZtK8U?key=16GuHjp6iW6Cc56zD5v2qQ" size="80" width="709" height="268" position="center" darkWidth="709" darkHeight="268" showCaption="false"}

## Amend the Payments settings after creating a sandbox

When you create a sandbox from a live production org., Salesforce will copy across the metadata, meaning that the live Payments configuration gets ported to the sandbox. You need to amend the Unaric Payments Custom settings so that you can then create or attach a test Unaric Payments account.

1. As an administrator, navigate to **Setup > Custom Settings**.
2. In the list of settings, Select **Unaric Payments settings**.
3. Use the **Manage** button to show the current settings and click **Edit**.
4. Remove the content of the **Customer ID&#x20;**&#x66;ield. If you have an existing Payments test account that you want to link, enter its **Configuration ID** of that account in this field.
5. Make sure the field **Is Running Live** is unchecked.
6. Make sure the field **Server URL** contains the value *test.protectedpayments.net*.
7. Click **Save&#x20;**&#x74;o finish. You can now go to the **Unaric Payments Setup** tab and follow the instructions to create a new test account.&#x20;

:::hint{type="info"}
If the screen is asking for an API key then contact [support@unaric.com](mailto\:support@asperato.com) for assistance and include the Configuration ID.
:::

## Optional Sandbox Apex class

This class prevents live configuration settings from being copied over to sandboxes. When ran, the class will delete any content in the **Unaric Payments protected settings** and modify the content of the **Unaric Payments settings** so that the field **Is Running Live** is unchecked, the **Server URL** is set to *test.protectedpayments.net,* and the field **Customer ID** is blanked out.

.
