Sandbox only, not available in production. In production this route returns 404 Not Found.
Partner organisations only. A Payroll organisation calling this endpoint receives 405 Method Not Allowed.
Ask GoCardless’s sandbox to move the employer’s Direct Debit mandate to the given outcome. Penfold does not change the mandate status itself. GoCardless sends its usual webhook, and direct_debit_mandate_status on GET /employers/{employer_id} changes once Penfold has processed it. The simulation skips the wait for the bank, so the status changes much sooner than it would in production.
Path parameters
-
The employer's
id, as returned byGET /employers. This is not the employer'sexternal_reference.
Body
Required
-
The mandate outcome to simulate. Each outcome needs the mandate to be in a certain status first.
activatedneedsPendingSubmissionand moves the mandate toActive.failedneedsPendingSubmissionorSubmittedand moves the mandate toFailed.cancelledneeds any status exceptCancelled, and cancels the mandate in GoCardless, which moves it toCancelled.Values are
activated,failed, orcancelled.
Responses
-
GoCardless accepted the simulation. The mandate status changes when its webhook is processed.
-
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. Also returned in production.
-
Method not allowed.
-
The simulation cannot run for this employer. The
codefield says why.
curl \
--request POST 'https://payroll-api.getpenfold.dev/v4/sandbox/employers/{employer_id}/direct_debit_mandate' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"outcome": "activated"
}'
{
"outcome": "activated"
}
{
"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."
}
{
"code": "NoDirectDebitMandate",
"error": "the employer has no Direct Debit mandate"
}