Railsr.Resources.Cards (Railsr v1.0.0)

Copy Markdown View Source

Railsr Card API — virtual and physical card management.

Note: Card functionality is available in the LIVE environment only. Card programmes must be enabled on your customer account before issuing cards.

Card Lifecycle

create  (pending)  active  frozen <> active  cancelled
                                                 replaced

Spend Control Rules

Each card can have multiple rules governing spend:

  • :amount_limit — cap per transaction or per period
  • :mcc_block — block specific merchant category codes
  • :country_block — block specific country codes
  • :mcc_allow — allowlist mode: only allow listed MCCs

Digital Wallets (Labs)

Apple Pay and Google Pay provisioning is available via the Labs API using create_payment_token/3. Requires MeaWallet integration to be enabled.

Summary

Functions

Activate a card (moves from pending to active).

Cancel a card permanently.

Create a virtual or physical card.

Provision a digital wallet token (Apple Pay / Google Pay) — Labs API.

Create a spend-control rule on a card.

Freeze a card (temporarily blocks all transactions).

Retrieve a card by ID.

Retrieve full PAN, CVV, and expiry via MeaWallet secure display.

Get a specific card programme.

Get a specific card rule.

List digital wallet tokens provisioned on a card — Labs API.

List card programmes available for the customer.

List all rules on a card.

List card transactions (authorisations, clearings, refunds).

Replace a card (lost, stolen, or damaged).

Reset PIN attempt counter after lockout (Debit-Card-2/3 only).

Suspend a card (admin-level suspension).

Unfreeze a card (re-activates a frozen card).

Generic card status update.

Functions

activate(card_id, opts \\ [])

@spec activate(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Activate a card (moves from pending to active).

cancel(card_id, opts \\ [])

@spec cancel(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Cancel a card permanently.

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Create a virtual or physical card.

Required params

  • :ledger_id — the ledger this card is funded from
  • :card_type"virtual" | "physical"

  • :card_programme_id — BIN programme to issue against

Optional

  • :card_holder_name — printed name (physical cards)
  • :physical_delivery_address — delivery address map (physical only)
  • :metadata

create_payment_token(card_id, params, opts \\ [])

@spec create_payment_token(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Railsr.Error.t()}

Provision a digital wallet token (Apple Pay / Google Pay) — Labs API.

Requires MeaWallet integration to be enabled on your card programme.

Params

  • :wallet_provider"apple_pay" | "google_pay"

  • :nonce — provider-supplied provisioning nonce
  • :nonce_signature — signed nonce from wallet provider SDK
  • :certificates — certificate chain (Apple Pay)

create_rule(card_id, params, opts \\ [])

@spec create_rule(String.t(), map(), keyword()) ::
  {:ok, Railsr.Types.CardRule.t()} | {:error, Railsr.Error.t()}

Create a spend-control rule on a card.

Rule types

Amount limit

%{
  rule_type: "amount_limit",
  limit_amount: 10_000,      # pence
  limit_currency: "GBP",
  limit_interval: "daily"    # "transaction" | "daily" | "weekly" | "monthly"
}

MCC block (block specific merchant categories)

%{rule_type: "mcc_block", mcc_list: ["7995", "6011"]}

Country block

%{rule_type: "country_block", country_list: ["CN", "RU"]}

delete_rule(card_id, rule_id, opts \\ [])

@spec delete_rule(String.t(), String.t(), keyword()) ::
  :ok | {:error, Railsr.Error.t()}

Delete a card rule.

freeze(card_id, opts \\ [])

@spec freeze(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Freeze a card (temporarily blocks all transactions).

get(card_id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Retrieve a card by ID.

get_pan(card_id, opts \\ [])

@spec get_pan(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Railsr.Error.t()}

Retrieve full PAN, CVV, and expiry via MeaWallet secure display.

The raw PAN is never returned in plaintext to the server — only via the secure MeaWallet widget rendered client-side.

get_programme(programme_id, opts \\ [])

@spec get_programme(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.CardProgramme.t()} | {:error, Railsr.Error.t()}

Get a specific card programme.

get_rule(card_id, rule_id, opts \\ [])

@spec get_rule(String.t(), String.t(), keyword()) ::
  {:ok, Railsr.Types.CardRule.t()} | {:error, Railsr.Error.t()}

Get a specific card rule.

list(query \\ %{}, opts \\ [])

@spec list(
  map(),
  keyword()
) :: {:ok, [Railsr.Types.Card.t()]} | {:error, Railsr.Error.t()}

List cards.

Query params

  • :ledger_id
  • :enduser_id
  • :card_type
  • :status
  • :limit / :offset

list_payment_tokens(card_id, opts \\ [])

@spec list_payment_tokens(
  String.t(),
  keyword()
) :: {:ok, list()} | {:error, Railsr.Error.t()}

List digital wallet tokens provisioned on a card — Labs API.

list_programmes(opts \\ [])

@spec list_programmes(keyword()) ::
  {:ok, [Railsr.Types.CardProgramme.t()]} | {:error, Railsr.Error.t()}

List card programmes available for the customer.

list_rules(card_id, opts \\ [])

@spec list_rules(
  String.t(),
  keyword()
) :: {:ok, [Railsr.Types.CardRule.t()]} | {:error, Railsr.Error.t()}

List all rules on a card.

list_transactions(card_id, query \\ %{}, opts \\ [])

@spec list_transactions(String.t(), map(), keyword()) ::
  {:ok, list()} | {:error, Railsr.Error.t()}

List card transactions (authorisations, clearings, refunds).

Query params

  • :from / :to — ISO 8601 datetimes
  • :transaction_type"card-debit" | "card-credit"

  • :limit / :offset

replace(card_id, params, opts \\ [])

@spec replace(String.t(), map(), keyword()) ::
  {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Replace a card (lost, stolen, or damaged).

Params

  • :replacement_reason"lost" | "stolen" | "damaged" | "expired"

  • :card_type — optional, defaults to same type as original
  • :physical_delivery_address — required for physical replacements

reset_pin_attempts(card_id, opts \\ [])

@spec reset_pin_attempts(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, Railsr.Error.t()}

Reset PIN attempt counter after lockout (Debit-Card-2/3 only).

suspend(card_id, opts \\ [])

@spec suspend(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Suspend a card (admin-level suspension).

unfreeze(card_id, opts \\ [])

@spec unfreeze(
  String.t(),
  keyword()
) :: {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Unfreeze a card (re-activates a frozen card).

update_status(card_id, status, opts \\ [])

@spec update_status(String.t(), String.t(), keyword()) ::
  {:ok, Railsr.Types.Card.t()} | {:error, Railsr.Error.t()}

Generic card status update.