GoCardless Blocks API.
Fraud prevention mechanism to block specific customers, email addresses, bank accounts, or device fingerprints from creating new mandates.
Block types
"email"— block a specific email address"email_domain"— block an entire email domain"device_fingerprint"— block by device fingerprint"bank_account"— block a specific bank account
Example
{:ok, block} = GoCardlessClient.Resources.Blocks.create(client, %{
block_type: "email",
reason_type: "fraud",
resource_reference: "fraudster@example.com"
})
Summary
Functions
Creates blocks by reference — blocks all accounts linked to an existing resource.
Eagerly collects all blocks into a list.
Creates a block.
Disables a block, stopping it from preventing mandate creation.
Re-enables a previously disabled block.
Retrieves a single block by ID.
Returns a page of blocks. Filter by :block_type, :reason_type, :created_at[gte].
Returns a lazy Stream over all pages of blocks.
Functions
@spec block_by_reference(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Creates blocks by reference — blocks all accounts linked to an existing resource.
For example, you can block all bank accounts and email addresses linked to a mandate or payment that was used fraudulently.
Params
:reference_type—"mandate","payment","customer"(required):reference_id— ID of the reference resource (required):reason_type—"fraud"or"other"(required):reason_description— optional human-readable reason
@spec collect_all(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, [map()]} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Eagerly collects all blocks into a list.
@spec create(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Creates a block.
Params
:block_type—"email","email_domain","device_fingerprint", or"bank_account"(required):reason_type—"fraud"or"other"(required):resource_reference— the value to block (required):reason_description— human-readable reason (optional)
@spec disable(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Disables a block, stopping it from preventing mandate creation.
@spec enable(GoCardlessClient.Client.t(), String.t(), map(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Re-enables a previously disabled block.
@spec get(GoCardlessClient.Client.t(), String.t(), keyword()) :: {:ok, map()} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Retrieves a single block by ID.
@spec list(GoCardlessClient.Client.t(), map(), keyword()) :: {:ok, %{items: [map()], meta: map()}} | {:error, GoCardlessClient.APIError.t() | GoCardlessClient.Error.t()}
Returns a page of blocks. Filter by :block_type, :reason_type, :created_at[gte].
@spec stream(GoCardlessClient.Client.t(), map(), keyword()) :: Enumerable.t()
Returns a lazy Stream over all pages of blocks.