ClearBank.Payments.ConfirmationOfPayee (ClearBank v1.0.0)

Copy Markdown View Source

Confirmation of Payee (CoP) — pre-payment name checking service.

CoP allows you to verify that an account holder's name matches the sort code and account number before sending a payment. This is mandatory for PSPs under UK Payment Systems Regulator (PSR) rules.

Match results

The API returns one of:

  • "MATC" — full match
  • "CLOSE" — close match (possible typo)
  • "NOMATCH" — no match
  • "INAM" — account type mismatch (business vs. personal)
  • "PANM" — partial match

Opting accounts out of CoP

You can opt individual real or virtual accounts out of CoP (inbound checks), for example for operational/internal accounts.

Examples

# Check a payee before sending
{:ok, result} = ClearBank.Payments.ConfirmationOfPayee.check(client, %{
  account_type: "Personal",
  account_name: "Jane Smith",
  sort_code: "040004",
  account_number: "12345678"
})

# => %{"matchResult" => "MATC", ...}

Summary

Functions

Sends an outbound CoP name verification request.

Opts a real account out of inbound CoP checks.

Opts a virtual account out of inbound CoP checks.

Functions

check(client, params)

Sends an outbound CoP name verification request.

Required params

  • :account_name - name to check
  • :sort_code - 6-digit sort code
  • :account_number - 8-digit account number

Optional params

  • :account_type - "Personal" | "Business" (default: "Personal")

  • :secondary_reference - secondary reference data (for building societies)

Examples

{:ok, result} = ClearBank.Payments.ConfirmationOfPayee.check(client, %{
  account_name: "Jane Smith",
  sort_code: "040004",
  account_number: "12345678",
  account_type: "Personal"
})

opt_out_account(client, account_id)

@spec opt_out_account(ClearBank.Client.t(), String.t()) :: ClearBank.HTTP.result()

Opts a real account out of inbound CoP checks.

Examples

{:ok, _} = ClearBank.Payments.ConfirmationOfPayee.opt_out_account(client, "acct-uuid")

opt_out_virtual(client, account_id, virtual_account_id)

@spec opt_out_virtual(ClearBank.Client.t(), String.t(), String.t()) ::
  ClearBank.HTTP.result()

Opts a virtual account out of inbound CoP checks.

Examples

{:ok, _} = ClearBank.Payments.ConfirmationOfPayee.opt_out_virtual(client, "acct-uuid", "virt-uuid")