# Create a Plaid integration This guide describes how to integrate the Plaid [Auth product](https://plaid.com/products/auth/) with your Rebilly account and use it to verify customers' bank credentials, which simplifies the process for the customer. To complete this guide an active gateway that supports ACH is required. 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). ## Prerequisites Complete this section to create resources and also to gather your website ID, organization ID, and secret API key. These resources and details are required to complete this guide using your Rebilly sandbox environment. If you have already created these resources, skip this step and continue to [Configure Plaid integration](#configure-plaid-integration). details summary Expand to complete ### Obtain IDs and a secret API key This step describes how to obtain your website ID, organization ID, and secret API key from 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). 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/). 2. Obtain your organization ID and website ID: 1. In the left navigation bar, press . 2. In the **Management** section, press **My organization & websites**. 3. In the **Organization details** section, note the **ID** value. 4. In the **Website** section, note the **ID** value. For more information, see [Organizations and websites](/docs/settings/organizations-and-websites). 3. Obtain your secret API key: 1. In the left navigation bar, press . 2. In the **Development** section, press **API keys**. 3. 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. 4. Select a secret key and copy the **Key** value. ### Create a customer This API interaction creates, or updates, a customer in your Rebilly sandbox account. For more information, see [Create a customer](/docs/dev-docs/api/customers/putcustomer). details summary How to use the interactive example 1. Select the sandbox server environment: 1. In the top right of the interactive example, press the **Environment** dropdown. 2. Select **Sandbox server**. 2. Enter your organization ID: 1. Locate `server /customers/{id}` press . 2. In the **Server variables** section, press **Edit**. 3. In the **Value** field, enter your organization ID and press **Save**. 3. 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 a secret API key](#obtain-ids-and-a-secret-api-key). 4. 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`. 5. Enter your website ID: 1. Press **Body**. 2. In the `websiteId`, enter your website ID. 3. Optionally, change the customer details. 6. Press **Send**. The `id` value from this response is used as the `customerId` value in [Step 3](#3.-create-a-transaction). ## Configure Plaid integration ### 1. Set up Plaid Set up Plaid to create a link that allows customers to connect their bank account to your application. 1. Sign in to your [Plaid dashboard](https://dashboard.plaid.com/). 2. In the top navigation bar, press **Team settings** > **Application**. 3. Add your application information, then press **Save changes**. 4. In the top navigation bar, press **Customize** > **Application**. 5. Customize your Plaid link. For guidance, see [Link best practices](https://plaid.com/docs/link/best-practices/). 6. In the top navigation bar, press **Team settings** > **Keys**. Use these credentials in the next step. ### 2. Connect Plaid to Rebilly Connect Plaid to Rebilly to enable the Plaid integration. 1. In your browser, in a new tab, go to [Rebilly](https://app-sandbox.rebilly.com/). 2. In the left navigation bar, press , then press **Plaid**. 3. Enter your **Client ID** and **Secret key**, and press **Save**. ### 3. Create a transaction Create a transaction using the Rebilly API. The transaction accepts ACH payments and uses the Plaid integration to authenticate the customer's bank credentials. This step requires a customer ID. If you have not created a customer, see [Create a customer](#create-a-customer). 1. Create a transaction using the Rebilly APIUsing the interactive API component below, complete the following steps. 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 [Prerequisites](#prerequisites). 3. Enter your website ID, customer ID, and transaction details: 1. Press **Body**. 2. In the `websiteId` field, enter your website ID. 3. In the `customerId` field, enter your customer ID. Example: `cus_01HDP7FFX2PGDVH1995EA4QY95`. 4. In the `amount` field, enter `75`. 5. In the `paymentInstruction` field, enter `ach`. 6. In the `billingAddress` field, enter the billing address for your customer. 7. In the `requestId` field, enter a unique string of values. This value must be unique for each transaction. 8. Use the `notificationUrl` and `redirectUrl` fields to manage the offsite payment process. For this guide, use `http://example.com`. 4. Press **Send**. You have created a transaction with a `unknown` result and a `waiting-approval` status. 5. In the response, in the `_links` array, locate the `"rel": "approvalUrl"`, the `href` field. This URL is a hosted payment URL and is used to complete the payment. Example: `https://sandbox.secure-payments.app/payments/approval/91b8e739-f333-47ea-8d92-176cbc247e1a/b9ebd7b3261842daba15fffc65ba992a/` 6. Open the URL in a new browser window or tab. 7. Continue to the next step — [Complete the payment using a hosted payment form](#complete-the-payment-using-a-hosted-payment-form). 2. Complete the payment using a hosted payment formWith the URL from the previous step open in a new browser window or tab, complete the following steps. To preview the user's journey when using the Plaid [Auth product](https://plaid.com/products/auth/), see [Plaid user journey](#plaid-user-journey). 1. Select a bank. 2. Enter the following test credentials below: - **Username:** `user_good` - **Password:** `pass_good` 3. Submit the form. The hosted form will PATCH the transaction with the service credential from Plaid. 3. View activity in the customer timeline in RebillyTo view the transaction in the customer timeline, complete the following steps. 1. [Log in or sign up to Rebilly](https://app-sandbox.rebilly.com/), press , then press **Customers**. 2. In the **Name** column, then press the related customer. 3. Scroll down to the **Timeline** section and to view interactions. #### Plaid user journey This section describes the user journey when using the Plaid [Auth product](https://plaid.com/products/auth/) integration in Rebilly. | Plaid user journey | | --- | | ![Plaid user journey](/assets/plaid-user-journey-1.91e20cfab3939bdd7b91f4ab457f940732371f67231dc740c52dc74dbfde8296.a8224ebd.png) | ![Plaid user journey select bank](/assets/plaid-user-journey-2.6ac229656249e4e96973330ab991b03fb80acf42aebf6e1aeb640a62602bd5d1.a8224ebd.png) | ![Plaid user journey enter credentials](/assets/plaid-user-journey-3.42eecfa80215f941eb59707b85fe9483cdc41e79d60ef58ce0134947c2b1718f.a8224ebd.png) |