# Setting Up Mandates

Source: https://docs.gocardless.com/docs/partner-integrations/setting-up-mandates

# Setting up mandates

## Setting up Direct Debit mandates

You'll need to provide a way for your users to set up Direct Debit mandates with their customers (whom we'll refer to from now on as **"end customers"**) so they can start collecting payments from them.

A mandate allows you to pull money from an end customer's bank account with a simple API call.

> **Info: Mechanisms to add customers**
> We have three options for setting up Direct Debit mandates. [Read more about our different
>   solutions and view a comparison here](/docs/collect-payments/integration-planner).

## Sending merchants to your app

Firstly - once a merchant completes verification, there are two ways they might make their way to your platform to start setting up payments:

1. Via the post-onboarding redirect - if you've configured a **post onboarding URL** in your App settings, GoCardless redirects the merchant there automatically after they finish verification. In this case they land directly on your platform can finish setting up their account with you and start setting up payments.
2. Via the GoCardless dashboard - some merchants will land on the GoCardless dashboard, either by navigating there directly or returning after verification. To handle this, you can set a **payment setup URL** in your App settings. This controls where the "Get started with payments" prompt in the dashboard takes them - it should link to the page on your platform where they can begin creating mandates and payments.

_If no payment_setup_url is set, the prompt falls back to your post_onboarding_url, or your website_url if neither is configured._

![Partner - dashboard setup payments](/images/docs/partner-integrations/setting-up-mandates/screenshot_2026-04-23_at_15.15.45.png)

![Partners - payment setup URL](/images/docs/partner-integrations/setting-up-mandates/screenshot_2026-04-23_at_15.26.43.png)

## Making API Calls on behalf of your merchant

**Prerequisite:** We must have gotten and saved merchants' access tokens after following the steps [here](/docs/partner-integrations/connect-your-merchants#using-the-oauth-flow).

To make an API call against a merchant's account, we will have to use the **saved access token**. See an example below:

```php
<?php
require 'vendor/autoload.php';

$client = new \\GoCardlessPro\\Client([
// You'll need to identify the user that the customer is paying
// and fetch their access token
'access_token' => $user->gocardlessAccessToken,
// Change me to LIVE when you're ready to go live
'environment' => \\GoCardlessPro\\Environment::SANDBOX
]);
```

```python
import os

client = gocardless_pro.Client( # You'll need to identify the user that the customer is paying # and fetch their access token
access_token=user.gocardless_access_token, # Change this to 'live' when you are ready to go live.
environment='sandbox'
)
```

```ruby
require 'gocardless_pro'

client = GoCardlessPro::Client.new(

# You'll need to identify the user that the customer is paying

# and fetch their access token

access_token: user.gocardless_access_token,

# Remove the following line when you're ready to go live

environment: :sandbox
)
```

```java
package com.gcintegration;

GoCardlessClient client = GoCardlessClient
// You'll need to identify the user that the customer is paying
// and fetch their access token
.newBuilder(CurrentUser.gocardlessAccessToken)
// Change me to LIVE when you're ready to go live
.withEnvironment(GoCardlessClient.Environment.SANDBOX)
.build();
```

```javascript
const constants = require("gocardless-nodejs/constants");

const client = gocardless(
// We recommend storing your access token in an environment
// variable for security
user.GoCardlessAccessToken,
// Change this to constants.Environments.Live when you're ready to go live
constants.Environments.Sandbox,
);
```

```net
using GoCardless;

GoCardlessClient client = GoCardlessClient.Create(
// We recommend storing your access token in an
// configuration setting for security
User["GoCardlessAccessToken"],
// Change me to LIVE when you're ready to go live
GoCardlessClient.Environment.SANDBOX
);
```

```go
package main

	"fmt"

    gocardless "github.com/gocardless/gocardless-pro-go/v6"

)

func main() 
client, err := gocardless.New(config)
if err != nil 
}
```

### Collecting Payments

Once you have the client set up with your merchant's access token, use a Billing Request Flow to set up Direct Debit mandates or Pay By Banks on their behalf. This handles the full payer experience — collecting bank details, authorisation, and confirmation.

For a full walkthrough of Billing Request Flows and the payer journey, see [collecting payments](/docs/collect-payments).

## What's Next?

  
#### [Webhooks for partners](/docs/partner-integrations/webhooks-for-partners)

Learn about webhook events and how to handle them for your partner integration.

  
#### [Responding to mandate events](/docs/collect-payments/events-and-webhooks/mandate-events)

Handle mandate lifecycle events to keep your integration up to date.