> For the complete documentation index, see [llms.txt](https://docs.getpenfold.dev/dev/llms.txt)

# Create a Direct Debit session

> POST /employers/{employer_id}/direct-debit-sessions
> 
> **Partner organisations only.** A Payroll organisation calling this
> endpoint receives `405 Method Not Allowed`.
> 
> Create a Direct Debit session for an employer. Returns a redirect_url that you open
> in the employer admin's browser so they can set up a Direct Debit mandate on
> Penfold's platform.



## Servers
- https://payroll-api.getpenfold.dev/v4: https://payroll-api.getpenfold.dev/v4


## Authentication methods
- O auth2 client credentials


## Parameters

### Path parameters

- **employer_id** (string)



### Body: application/json (object)

- **return_url** (string)
  The URL the employer is redirected to once the Direct Debit session reaches a terminal state. Must be HTTPS and must already be registered against your organisation.



## Responses
### 201
Direct Debit session created successfully.

#### Body: application/json (object)
- **redirect_url** (string)
  Full URL to send the employer admin to. Contains a Penfold-issued short-lived, one-time token. Do not construct or modify this URL.

- **expires_at** (string(date-time))
  ISO 8601 instant after which the session and redirect_url are invalid. Sessions expire 30 minutes after creation unless otherwise stated.


### 400
Bad request, the request is malformed or contains invalid data.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.

- **validation_errors** (array[object])


### 401
Unauthorized, the request requires authentication, and the provided credentials are either missing or incorrect.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 404
Employer not found, the specified employer_id does not match any employer your organisation can access.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 405
Method not allowed.

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 409
Conflict — a Direct Debit session cannot be created because the employer is not
eligible. This occurs when the employer does not pay by Direct Debit, when the
employer is not held with Penfold, or when the employer's status is not
`MissingDD`, `Pending` or `Active`.


#### Body: application/json (object)
- **error** (string)
  A descriptive error message.


### 500
Internal server error

#### Body: application/json (object)
- **error** (string)
  A descriptive error message.



[Powered by Bump.sh](https://bump.sh)
