# Set up your environment This topic describes how to set up your Rebilly environment and add data needed to process transactions such as products, pricing plans, customers, and orders. ## Set up a payment gateway To process transactions, you must have at least one payment gateway configured in your Rebilly account. If you are testing in the sandbox environment, a test payment gateway called `TestProcessor` is already configured. For more information, see [Set up a payment gateway](/docs/settings/set-up-a-gateway). To route transactions dynamically between payment gateways based on real-time data and selected parameters, see [Payment gateway routing](/docs/settings/gateway-routing). ## Configure payment methods Payment methods that are displayed in payment forms, such as payment cards and digital wallets, are configured when setting up a gateway account. If you are testing in the sandbox environment, configure payment methods to display in the `TestProcessor` gateway. - To add a digital wallet, such as Google Pay™, Apple Pay, or Samsung Pay, as a payment method, see [Set up digital wallets](/docs/dev-docs/digital-wallets). - To add other payment methods, such as ACH, PayPal, and more, see [Set up a payment gateway](/docs/settings/set-up-a-gateway). To learn about payment method automation, such as payment method display order and display payment methods by location, see [Payment method automations](/docs/settings/payment-methods#payment-method-automations). ## Activate the ready to payout instruction To process payouts, you must have an active payment gateway with payout settings configured. This process describes how to activate the ready to payout instruction on the `TestProcessor` payment gateway in the sandbox environment. The `TestProcessor` payment gateway is automatically configured in the sandbox environment when you sign up to Rebilly. For more information on payment gateway settings, see [Set up a payment gateway](/docs/settings/set-up-a-gateway). 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/). 2. In the left navigation bar, press . 3. In the **Configuration** section, press **Gateway accounts**. 4. In the **ID** column, press **TestProcessor**. 5. In the right of the page, press **Edit gateway account**. 6. Scroll down to the **Ready to payout instruction** section, and turn on the **Activate this gateway for payouts** toggle. 7. Select one of the following options: - **Covered payout:** Use this gateway if it previously processed a payment for the same, or a greater, amount. - **Approved payments:** Use this gateway if it previously processed a payment for the same amount. The customer must have a previously approved transaction, in the same currency, on this gateway. - **All payments:** Use this gateway for any amount. 8. Scroll to the bottom of the page and press **Save gateway account**. ## Obtain IDs and API keys Learn how to get your website ID, organization ID, and API keys in your Rebilly sandbox account. When you first log in to Rebilly, you create an organization as part of the setup process. A default website is created when a new organization is created. For more information, see [Organizations and websites](/docs/settings/organizations-and-websites). details summary Obtain your organization ID and website ID 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/). 2. In the left navigation bar, press . 3. In the **Management** section, press **My organization & websites**. 4. In the **Organization details** section, note the **ID** value. 5. In the **Website** section, note the **ID** value. details summary Obtain your publishable API key 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/). 2. In the left navigation bar, press . 3. In the **Development** section, press **API keys**. 4. Optionally, if you have not created a publishable key: 1. In top right of the screen, press **Create API key**. 2. In the **API key type** section, select **Publishable**. 3. Optionally, in the **Organizations** dropdown, select the organizations that can use the API key. 4. Optionally, in the **Allowed IPs** field, enter the IP addresses that are permitted to use the API key. 5. Press **Save API key**. 6. Go to the API keys page. 5. Select a publishable key and copy the **Key** value. details summary Obtain your secret API key 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/). 2. In the left navigation bar, press . 3. In the **Development** section, press **API keys**. 4. Optionally, if you have not created a secret key: 1. In top right of the screen, press **Create API key**. 2. In the **API key type** section, select **Secret**. 3. Optionally, in the **Organizations** dropdown, select the organizations that can use the API key. 4. Optionally, in the **Allowed IPs** field, enter the IP addresses that are permitted to use the API key. 5. Press **Save API key**. 6. Go to the API keys page. 5. Select a secret key and copy the **Key** value. ## Add data to your Rebilly environment This section describes how to add data to your sandbox environment using the Rebilly API. ### Create a product This API interaction creates a product in your Rebilly sandbox account. For more information, see [Create a product](/docs/dev-docs/api/products/postproduct/). To create a product you must have your Rebilly website ID, organization ID, and secret API key. For more information, see [Obtain IDs and API keys](#obtain-ids-and-api-keys). details summary How to use the interactive example 1. Enter your organization ID: 1. Beneath the **Environment** field, press `{{server}}`. 2. Beneath the URL, press **Show nested variables**, then press **Edit**. 3. In the **Value** field, enter your organization ID and press **Save**. 2. Enter your secret API key: 1. Press **Security**. 2. In the **API key** field, press `{{SecretApiKey}}`, then press **Set value**. 3. In the **Value** field, enter your secret Rebilly sandbox API key and press **Save**. For more information, see [Obtain IDs and API keys](#obtain-ids-and-api-keys). 3. Optionally, to change the product details, press **Body**. 4. Press **Send**. The `id` value from this response is used in [Create a pricing plan](#create-a-pricing-plan). ### Create a pricing plan This API interaction creates a pricing plan for a product in your Rebilly sandbox account. For more information, see [Create a plan](/docs/dev-docs/api/plans/postplan/). To create a pricing plan, you must have a product ID. For more information, see [Create a product](#create-a-product). details summary How to use the interactive example 1. Enter your organization ID: 1. Beneath the **Environment** field, press `{{server}}`. 2. Beneath the URL, press **Show nested variables**, then press **Edit**. 3. In the **Value** field, enter your organization ID and press **Save**. 2. Enter your secret API key: 1. Press **Security**. 2. In the **API key** field, press `{{SecretApiKey}}`, then press **Set value**. 3. In the **Value** field, enter your secret Rebilly sandbox API key and press **Save**. For more information, see [Obtain IDs and API keys](#obtain-ids-and-api-keys). 3. Enter the product ID from the [Create a product](#create-a-product) response. 1. Press **Body**. 2. In the `productId` field, enter the `id` value from the [Create a product](#create-a-product) response. 3. Optionally, change the plan details. 4. Press **Send**. ### Create a customer For the purposes of this tutorial, you must create a customer in your system. A deposit request must be associated with a customer. This API operation prevents duplicate customers. If the customer already has an identifier within your system, that customer is updated. If the customer does not have an identifier, a new customer is created. For detailed information about this API operation, see [Upsert a customer](/catalog/all/customers/putcustomer). details summary How to use the interactive example 1. Enter your organization ID: 1. Beneath the **Environment** field, press `{{server}}`. 2. Beneath the URL, press **Show nested variables**, then press **Edit**. 3. In the **Value** field, enter your organization ID and press **Save**. 2. Enter your secret API key: 1. Press **Security**. 2. In the **API key** field, press `{{SecretApiKey}}`, then press **Set value**. 3. In the **Value** field, enter your secret Rebilly sandbox API key and press **Save**. For more information, see [Obtain IDs and API keys](#obtain-ids-and-api-keys). 3. Enter a customer ID: 1. In the URL field beneath the **Environment** field, press `{{id}}`. 2. Press **Set value**. 3. In the **Value** field, enter a customer ID. Example: `cus_01HDP7FFX2PGDVH1995EA4QY95`. 4. Enter your website ID: 1. Press **Body**. 2. In the `websiteId`, enter your website ID. 3. Optionally, change the customer details. 5. Press **Send**. Take note of the `id` value from this response. This value is used as the `customerId` later in this tutorial. ### Create an order This API interaction creates an order in your Rebilly sandbox account. To create an order, you must have a customer ID and a plan ID. For more information, see [Create a customer](#create-a-customer) and [Create a pricing plan](#create-a-pricing-plan). details summary How to use the interactive example 1. Enter your organization ID: 1. Beneath the **Environment** field, press `{{server}}`. 2. Beneath the URL, press **Show nested variables**, then press **Edit**. 3. In the **Value** field, enter your organization ID and press **Save**. 2. Enter your secret API key: 1. Press **Security**. 2. In the **API key** field, press `{{SecretApiKey}}`, then press **Set value**. 3. In the **Value** field, enter your secret Rebilly sandbox API key and press **Save**. For more information, see [Obtain IDs and API keys](#obtain-ids-and-api-keys). 3. Enter the customer ID, plan ID, and website ID: 1. Press **Headers**, then in the `Organization-Id` field, enter your organization ID. 2. Press **Body**. 3. In the `customerId` field, enter the `id` value from the [create a customer](#create-a-customer) response. 4. In the `id` field, enter the `id` value from the [create a pricing plan](#create-a-pricing-plan) response. 5. In the `websiteId` field, enter your website ID. 4. Press **Send**.