# Billing Request Component

Source: https://docs.gocardless.com/docs/collect-payments/integration-types/gocardless-components/billing-requests

# Billing Request Component

The Billing Request component guides the payer through a **Billing Request** — the GoCardless object that brings together the customer, their authorisation, and their bank details into a single, manageable object (see the [Billing Requests overview](/docs/collect-payments#collect-payments) for more). Depending on the Billing Request, it can:

- [Set up a Direct Debit mandate](/docs/collect-payments/integration-types/gocardless-components/billing-requests/mandates), for **Bacs (UK) and Sepa (EUR)**.
- [Collect a one-off Pay By Bank payment](/docs/collect-payments/integration-types/gocardless-components/billing-requests/pay-by-bank), in **GBP via Faster Payments**.

This page covers what both have in common. Before you start, complete the [general setup](/docs/collect-payments/integration-types/gocardless-components#1-setup) (access token and session token endpoint) and [configure the library](/docs/collect-payments/integration-types/gocardless-components#22-configure-the-library).

## 1. Mount the component

Create a `` where you want the component to appear:

```html
<div id="gc-billing"></div>
```

Then create the component and mount it. The options you pass depend on the flow, see [Setting up mandates](/docs/collect-payments/integration-types/gocardless-components/billing-requests/mandates#2-mount-the-component) and [Pay By Bank](/docs/collect-payments/integration-types/gocardless-components/billing-requests/pay-by-bank#4-mount-the-component).

```javascript
const brComponent = gc.createComponent("billing-request", {
  // options, see below
  onError: (error) => console.error("Error: ", error),
});

brComponent.mount("#gc-billing");
```

## 2. Options

These options work the same in every flow:

| Property          | Description                                                                                                  | Required |
| ----------------- | ------------------------------------------------------------------------------------------------------------ | -------- |
| prefilledCustomer | Prefills the customer/billing details form (see [Prefilled customer details](#3-prefilled-customer-details)) | No       |
| appearance        | Custom appearance configuration, merged on top of the top-level `appearance`                                 | No       |
| onError           | `(error: GoCardlessError) => void` — called on error, in addition to the event bus                           | No       |

The remaining options depend on the flow, see the options of [Setting up mandates](/docs/collect-payments/integration-types/gocardless-components/billing-requests/mandates#2-mount-the-component) and [Pay By Bank](/docs/collect-payments/integration-types/gocardless-components/billing-requests/pay-by-bank#4-mount-the-component).

## 3. Prefilled customer details

Pass `prefilledCustomer` when creating the component to pre-populate the customer details form, in both mandate and Pay By Bank flows. It also pre-populates the Direct Debit form shown if a Pay By Bank payment [falls back](/docs/collect-payments/integration-types/gocardless-components/billing-requests/pay-by-bank#direct-debit-fallback). Bank details cannot be prefilled for security reasons.

```javascript
const gc = GcComponents.init({
  environment: "sandbox",
  sessionToken: fetchSessionToken,
});

const brComponent = gc.createComponent("billing-request", {
  prefilledCustomer: {
    firstName: "Components",
    lastName: "Tester",
    email: "components-tester@example.com",
    addressLine1: "65 Goswell Road",
    addressLine2: "",
    city: "London",
    postalCode: "EC1V 7EN",
  },
});

brComponent.mount("#gc-billing");
```

![Prefilled form](/images/docs/collect-payments/integration-types/gocardless-components/image-3.png)

## 4. Remember Me

Remember Me lets returning payers skip re-entering their details: when a payer enters an email address GoCardless has seen before, they verify their identity and their saved details are pre-filled. New payers can opt in to have their details saved for next time.

Remember Me is built into the Billing Request component and appears automatically, so there is nothing extra to install or configure. It currently supports the Bacs scheme only.

If you are building a custom checkout and want to use Remember Me without the Billing Request component, see [Remember Me Components](/docs/collect-payments/integration-types/gocardless-components/remember-me) for the standalone components.

## What's next?

  
#### [Setting up mandates](/docs/collect-payments/integration-types/gocardless-components/billing-requests/mandates)

Set up Bacs and Sepa Direct Debit mandates.

  
#### [Pay By Bank](/docs/collect-payments/integration-types/gocardless-components/billing-requests/pay-by-bank)

Collect one-off payments in GBP via Faster Payments.