User onboarding and account funding 
====================================

#### Use Plaid to simplify your onboarding and funding flow in Europe 

In this guide, we first walk through setting up an account linking flow that uses Plaid to connect your user's bank account. We'll then demonstrate how to verify the identity of your users which may help comply with KYC and AML regulations.

Finally, we'll show how to initiate payments while requiring that bank accounts involved in money movements are verified.

If you're looking for a guide that is specific to Plaid's One-Time Payment Initiation product and does not incorporate other features such as anti-fraud measures or Identity Verification, see [Add One-time Payment Initiation to your App](https://plaid.com/docs/payment-initiation/payment-initiation-one-time/index.html.md) .

This guide is specific to integrations serving end users in Europe (including non-EU countries such as the UK and Norway). For US payment solutions, see [Transfer](https://plaid.com/docs/transfer/index.html.md) .

#### Before you get started 

The [Auth](https://plaid.com/docs/auth/index.html.md) , [Identity](https://plaid.com/docs/identity/index.html.md) , and [Payments (Europe)](https://plaid.com/docs/payment-initiation/index.html.md) products covered in this guide can immediately be tried out in the Sandbox environment, which uses test data and does not interact with financial institutions.

To gain access to these products in the Production environments, [request product access](https://dashboard.plaid.com/settings/team/products) or [contact sales](https://plaid.com/contact/) . If you already are using Plaid products, you can also request access by contacting your account manager or submitting a [support ticket](https://dashboard.plaid.com/support/new/product-and-development/product-troubleshooting/request-product-access) .

### User onboarding 

The **Plaid flow** begins when the user registers with your app. The flow will connect your app to your user's financial institution.

(An image of "Step diagram")

**1**Your backend creates a `link_token` by using the[/link/token/create](https://plaid.com/docs/api/link/index.html.md#create-link-token) endpoint and passes the temporary token to your Client app.

(An image of "Step 1 diagram")

**2**Your Client app uses the `link_token` to initiate a Link flow for your user. The [onSuccess callback](https://plaid.com/docs/link/web/index.html.md#onsuccess) signals that the user has granted your app access to their financial institution.

(An image of "Step 2 diagram")

**3**The `onSuccess` payload contains a [public\_token](https://plaid.com/docs/link/web/index.html.md#link-web-onsuccess-public-token) which, after sending it to your backend, needs to be exchanged for a long-lived access token using the [/item/public\_token/exchange](https://plaid.com/docs/api/items/index.html.md#itempublic_tokenexchange) endpoint.

(An image of "Step 3 diagram")

**4**Using this access token your backend can now retrieve the user's bank account numbers via [/auth/get](https://plaid.com/docs/api/products/auth/index.html.md#authget) or their identity information (such as their full name) via [/identity/get](https://plaid.com/docs/api/products/identity/index.html.md#identityget) .

(An image of "Step 4 diagram")

#### Adding the Auth and Identity products to your app 

The steps listed above are broken down into more detail in the guides linked below. The first guide covers adding the [Auth](https://plaid.com/docs/api/products/auth/index.html.md) product (e.g. for obtaining the user's bank account numbers). The second covers the [Identity](https://plaid.com/docs/api/products/identity/index.html.md) product (e.g. for obtaining the user's legal name). Both guides describe almost identical steps, so you can follow either one.

The next section will highlight the single difference between the two and will show how you can use both products at the same time.

#### Auth 

Add Auth to your app

[Detailed steps](https://plaid.com/docs/auth/add-to-app/index.html.md)

#### Identity 

Add Identity to your app

[Detailed steps](https://plaid.com/docs/identity/add-to-app/index.html.md)

#### Creating a Link token 

Link token creation is the only step that requires changes when requesting both Auth and Identity-related information. To do so, pass both products as part of the [/link/token/create](https://plaid.com/docs/api/link/index.html.md#linktokencreate) request.

Create link token

```bash
curl -X POST https://sandbox.plaid.com/link/token/create \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}",
  "client_name": "Plaid Test App",
  "user": { "client_user_id": "${UNIQUE_USER_ID}" },
  "products": ["auth", "identity"], // using both products
  "country_codes": ["GB", "NL", "DE"],
  "language": "en",
  "webhook": "https://webhook.sample.com"
}'
```

#### End user experience 

During the Link flow, your user grants permission to all the data products that you request. The images below demonstrate examples of the panes Link will present when requesting access to one or multiple products.

(An image of "Plaid consent screen for sharing financial data with WonderWallet, featuring an 'Allow' button and 'Account details' section.")

(An image of "Plaid data sharing consent screen, listing Contact and Account details. Buttons: Allow, Cancel. Terms link present.")

### Optional steps and best practices 

The sections below in this guide describe optional steps you can use to improve link conversion or achieve KYC/AML compliance.

#### Preselecting a financial institution 

By default, Plaid will ask the user to manually select their financial institution. However, there might be cases where you already know which institution your user wants to use. For example, when your user has previously completed a sign up flow, you can increase conversion by skipping this part of the payment flow. This requires two steps:

1.  Call [/item/get](https://plaid.com/docs/api/items/index.html.md#itemget) with the `access_token` as an input parameter. This endpoint will return the [institution\_id](https://plaid.com/docs/api/items/index.html.md#item-get-response-item-institution-id) as part of the response.
2.  Provide the `institution_id` as part of the payment [/link/token/create](https://plaid.com/docs/api/link/index.html.md#linktokencreate) request.

Create link token with institution preselected

```bash
curl -X POST https://sandbox.plaid.com/link/token/create \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}",
  "client_name": "Plaid Test App",
  "user": { "client_user_id": "${UNIQUE_USER_ID}" },
  "products": ["payment_initiation"],
  "country_codes": ["GB", "NL", "DE"],
  "language": "en",
  "webhook": "https://webhook.sample.com",
  "payment_initiation": { "payment_id": "${PAYMENT_ID}" },
  "institution_id": "${INSTITUTION_ID}" // preselect institution_id
}'
```

#### Compliant account funding 

To help comply with KYC & AML regulations you may choose to restrict payments to your app from bank accounts whose owner was previously verified.

One-Time Payment Initiation can support this flow by requiring that a payment is to be made from a specific account. The process has three steps:

1.  Call [/auth/get](https://plaid.com/docs/api/products/auth/index.html.md#authget) with the `access_token` as an input parameter. This endpoint will return the user's account numbers as part of the response (Use [bacs](https://plaid.com/docs/api/products/auth/index.html.md#auth-get-response-numbers-bacs) for the UK and [international](https://plaid.com/docs/api/products/auth/index.html.md#auth-get-response-numbers-international) for the rest of Europe).
2.  Provide one of the account numbers under [options](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiation-payment-create-request-options) as part of the [/payment\_initiation/payment/create](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiationpaymentcreate) request. See the snippet below as an example.
3.  Provide the `institution_id` as part of the [/link/token/create](https://plaid.com/docs/api/link/index.html.md#linktokencreate) request, as described in the previous section.

Not all financial institutions support this feature. In the UK there is full support. In the rest of Europe, support may be limited. Plaid will let the user choose any account when their financial institution does not support this feature. It is recommended to also verify the origin of payments as part of your payment reconciliation process.

Create payment request

```bash
curl -X POST https://sandbox.plaid.com/payment_initiation/payment/create \
-H 'Content-Type: application/json' \
-d '{
  "client_id": "${PLAID_CLIENT_ID}",
  "secret": "${PLAID_SECRET}",
  "recipient_id": "${RECIPIENT_ID}",
  "reference": "Sample reference",
  "amount": {
    "currency": "GBP",
    "value": 1.99
  },
  "options": { // additional payee account restriction
    "bacs": {
        "account": "26207729",
        "sort_code": "560029"
    }
  }
}'
```

#### Compliant withdrawals 

To comply with KYC and AML regulations, you may want to restrict outbound money movements to accounts whose owner is verified. You can do this in the following ways:

##### Using Virtual Accounts 

Make sure your virtual account is set up before following these steps. For more information on setting up an account, see [Managing virtual accounts](https://plaid.com/docs/payment-initiation/virtual-accounts/managing-virtual-accounts/index.html.md) .

1.  Follow the [Payment Confirmation flow](https://plaid.com/docs/payment-initiation/virtual-accounts/payment-confirmation/index.html.md) to confirm that funds have settled in your virtual account.
2.  Fetch the payment object by calling [/payment\_initiation/payment/get](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiationpaymentget) with the `payment_id` of the payment you initiated. The payment object will contain a [transaction\_id](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiation-payment-get-response-transaction-id) , which corresponds to the payment's underlying virtual account transaction.
3.  Fetch the virtual account transaction by calling [/wallet/transaction/get](https://plaid.com/docs/api/products/virtual-accounts/index.html.md#wallettransactionget) with the `transaction_id`.
4.  The virtual account transaction will contain account details in the `counterparty` field.
5.  [Execute a Payout](https://plaid.com/docs/payment-initiation/virtual-accounts/payouts/index.html.md) using the `counterparty` details.

##### Using Auth data 

1.  Call [/auth/get](https://plaid.com/docs/api/products/auth/index.html.md#authget) with the `access_token` as an input parameter. This endpoint will return the user's verified account numbers as part of the response (Use [bacs](https://plaid.com/docs/api/products/auth/index.html.md#auth-get-response-numbers-bacs) for the UK and [international](https://plaid.com/docs/api/products/auth/index.html.md#auth-get-response-numbers-international) for the rest of Europe).
2.  Select accounts that can receive funds by filtering for `account.subtype = "checking"`.
3.  Initiate the withdrawal to any of the filtered accounts. You may want to let the user choose a preferred account in case there are multiple.

##### Using the request\_refund\_details flag 

This approach is not recommended since it is an optional flag with limited incomplete coverage dependent on the financial institution a payment was initiated to.

1.  Go through the [One-Time Payment Initiation flow](https://plaid.com/docs/payment-initiation/payment-initiation-one-time/index.html.md) and initiate a payment with the [request\_refund\_details](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiation-payment-create-request-options-request-refund-details) flag enabled.
2.  Fetch the payment object by calling [/payment\_initiation/payment/get](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiationpaymentget) and parse the [refund\_details](https://plaid.com/docs/api/products/payment-initiation/index.html.md#payment_initiation-payment-get-response-refund-details) field.
3.  Initiate the withdrawal to account specified in the `refund_details` field.