Integrating NetSuite Exchange Rates with Zuora using Suite Script and Secret Management

Integrating exchange rates from NetSuite into Zuora using Suite Script can streamline your financial operations and ensure that your pricing and billing are accurate and up-to-date. By securely storing Zuora’s API credentials in NetSuite’s Secret Management, you can enhance the security and efficiency of your integration.
Here’s a comprehensive guide on how to achieve this integration:

Step 1: Set Up NetSuite and Zuora API Access

1.1. Generate API Credentials for Zuora
– In Zuora, navigate to `Settings` > `Administration` > `Manage Users`.
– Create or select a user with API access and generate API credentials.
1.2. Store Zuora API Credentials in NetSuite Secret Management
– Navigate to `Setup` > `Company` > `Secret Management` > `Manage Secrets`.
– Create a new secret for Zuora API credentials and securely store the API Token.

Step 2: Develop SuiteScript to Fetch and Send Exchange Rates

2.1. Create a Script File
– Navigate to `Customization` > `Scripting` > `Scripts` > `New`.
– Choose `SuiteScript 2.0` and create a new script file.
2.2. Fetch Exchange Rates from NetSuite
– Use the `search` module to fetch the latest exchange rates.
Example Code:
define([‘N/search’, ‘N/https’, ‘N/secret’, ‘N/log’], function(search, HTTPS, secret, log) {
function get exchange rates() {
var exchangeRateSearch = search.create({
filters: [ /* add filters if necessary */ ],
columns: [‘currency’, ‘exchange rate’, ‘effective date’]
var exchangeRates = []; {
currency: result.getValue(‘currency’),
rate: result.getValue(‘exchangerate’),
effectiveDate: result.getValue(‘effectivedate’)
return true;
return exchange-rates;
**2.3. Send Exchange Rates to Zuora**
– Retrieve Zuora API credentials from Secret Management.
– Use the `https` module to send a `PUT` request to Zuora’s exchange rate endpoint.
**Example Code:**
function sendToZuora(exchangeRates) {
var zuoraToken = secret.retrieve({ guid: ‘your-zuora-secret-guid’ });
exchangeRates.forEach(function(rate) {
var payload = JSON.stringify({
currency: rate.currency,
effectiveDate: rate.effectiveDate,
rate: rate.rate
var headers = {
‘Authorization’: ‘Bearer’ + zuoraToken,
‘Content-Type’: ‘application/json’
var response = https.put({
url: ‘’,
body: payload,
headers: headers
log.debug(‘Response from Zuora’, response.body);
function execute(context) {
var exchangeRates = getExchangeRates();
return {
execute: execute

Step 3: Deploy and Schedule the Script

3.1. Deploy the Script
– Navigate to `Customization` > `Scripting` > `Script Deployments` > `New`.
– Deploy the Script created in the previous step.
3.2. Schedule the Script
– Configure the deployment to run at a frequency that matches your business needs (e.g., daily).

Step 4: Testing and Validation

4.1. Test the Script in a Sandbox Environment
– Ensure that the Script works as expected in a sandbox environment before deploying it to production.
4.2. Validate Exchange Rates in Zuora
– Cross-check the exchange rates in Zuora to ensure they match the rates in NetSuite.


You can automate and secure your financial data synchronization by integrating NetSuite’s exchange rates with Zuora using SuiteScript and securely managing API credentials with NetSuite Secret Management. This integration enhances operational efficiency, ensures data accuracy, and reduces the risk of manual errors.
Please contact our support team with questions or for further customization. Happy integrating!
This guide integrates NetSuite exchange rates with Zuora, leveraging SuiteScript and NetSuite’s Secret Management for secure and efficient data handling.