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.
Responses
-
Direct Debit session created successfully.
-
Bad request, the request is malformed or contains invalid data.
-
Unauthorized, the request requires authentication, and the provided credentials are either missing or incorrect.
-
Employer not found, the specified employer_id does not match any employer your organisation can access.
-
Method not allowed.
-
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,PendingorActive. -
Internal server error
curl \
--request POST 'https://payroll-api.getpenfold.dev/v4/employers/{employer_id}/direct-debit-sessions' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"return_url": "https://partner.example.com/penfold/direct-debit-return"
}'
{
"return_url": "https://partner.example.com/penfold/direct-debit-return"
}
{
"redirect_url": "https://platform.getpenfold.com/partner/direct-debit?token=eyJhbGciOiJIUzI1NiJ9...",
"expires_at": "2026-05-06T10:35:00Z"
}
{
"error": "Bad request: invalid data provided.",
"validation_errors": [
{
"field": "email",
"message": "Email address is invalid."
}
]
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Bad request: invalid data provided."
}
{
"error": "Employer does not pay by Direct Debit"
}
{
"error": "Employer is not set up for Direct Debit with Penfold"
}
{
"error": "Employer is not eligible for Direct Debit setup - status must be 'MissingDD', 'Pending' or 'Active'"
}
{
"error": "Bad request: invalid data provided."
}