Mandates#

Mandates represent authorization from a tenant to collect payments via Direct Debit. CasaPay supports BACS (UK), SEPA (EU), and ACH (US) mandate schemes.

The Mandate object#

AttributeTypeDescription
idstringUnique identifier with md_ prefix
objectstringAlways "mandate"
customerstringCustomer ID
payment_methodstringAssociated Payment Method ID
statusenumpending_submission, submitted, active, cancelled, expired, failed
schemeenumbacs, sepa, ach
referencestringUnique mandate reference
next_possible_charge_datestringEarliest date a charge can be created (YYYY-MM-DD)
creditor_identifierstringYour creditor ID for the scheme
metadatahashKey-value pairs
createdtimestampTime at which the object was created

Status Flow#

pending_submission → submitted → active → cancelled / expired / failed
{
  "id": "md_abc123",
  "object": "mandate",
  "customer": "cus_123456789",
  "payment_method": "pm_dd_sepa",
  "status": "active",
  "scheme": "sepa",
  "reference": "CASAPAY-MD-ABC123",
  "next_possible_charge_date": "2025-02-03",
  "creditor_identifier": "DE98ZZZ09999999999",
  "metadata": {
    "property_id": "prop_456"
  },
  "created": 1706140800
}

Create a Mandate#

POST /v1/mandates

ParameterTypeRequiredDescription
customerstringYesCustomer ID
schemestringYesDirect debit scheme: bacs, sepa, ach
account_holder_namestringYesName on the bank account
account_numberstringConditionalBank account number (BACS/ACH)
sort_codestringConditionalSort code (BACS)
ibanstringConditionalIBAN (SEPA)
routing_numberstringConditionalRouting number (ACH)
metadatahashNoKey-value pairs
curl https://api.casapay.com/v1/mandates \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": "cus_123456789",
    "scheme": "sepa",
    "account_holder_name": "Jane Doe",
    "iban": "DE89370400440532013000"
  }'
{
  "id": "md_abc123",
  "object": "mandate",
  "status": "pending_submission",
  "scheme": "sepa",
  "reference": "CASAPAY-MD-ABC123",
  "next_possible_charge_date": "2025-02-03",
  "created": 1706140800
}

Retrieve a Mandate#

GET /v1/mandates/:id

curl https://api.casapay.com/v1/mandates/md_abc123 \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"

Update a Mandate#

POST /v1/mandates/:id

curl https://api.casapay.com/v1/mandates/md_abc123 \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc" \
  -H "Content-Type: application/json" \
  -d '{"metadata": {"lease_id": "lease_789"}}'

List Mandates#

GET /v1/mandates

ParameterTypeDescription
customerstringFilter by customer
schemestringFilter by scheme
statusstringFilter by status
limitintegerNumber of objects (1–100)
curl "https://api.casapay.com/v1/mandates?customer=cus_123456789&status=active" \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"

Cancel a Mandate#

POST /v1/mandates/:id/cancel

curl -X POST https://api.casapay.com/v1/mandates/md_abc123/cancel \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"

Reinstate a Mandate#

Reinstates a cancelled mandate if the scheme allows it.

POST /v1/mandates/:id/reinstate

curl -X POST https://api.casapay.com/v1/mandates/md_abc123/reinstate \
  -H "Authorization: Bearer sk_test_4eC39HqLyjWDarjtT1zdp7dc"