Weavr.Cards (Weavr v1.0.0)

Copy Markdown View Source

Managed Cards — virtual and physical payment cards.

All paths and operations are verified against Weavr's published docs.

Confirmed endpoints

  • GET /managed_cards — list all cards
  • POST /managed_cards — create a card
  • GET /managed_cards/{id} — get a card
  • PATCH /managed_cards/{id} — update card details
  • POST /managed_cards/{id}/block — block a card
  • POST /managed_cards/{id}/unblock — unblock a card
  • DELETE /managed_cards/{id} — destroy a card
  • POST /managed_cards/{id}/physical — upgrade to physical card
  • GET /managed_cards/{id}/statement — card transaction statement
  • GET /managed_cards/{id}/spend_rules — get spend rules
  • POST /managed_cards/{id}/spend_rules — create spend rules
  • PUT /managed_cards/{id}/spend_rules — update spend rules
  • DELETE /managed_cards/{id}/spend_rules — remove spend rules

Card modes

  • Prepaid — the card has its own balance; fund it via transfers.
  • Debit — taps into the balance of a linked parent managed account (set "parentManagedAccountId" at creation).

Physical card fulfilment states (via webhook)

"REQUESTED""SENT_FOR_FULFILLMENT""DISPATCHED""DELIVERED"

These are reported via the managed_cards_physical_cards_upgrade_watch webhook.

List query parameters

  • offset, limit, profileId, friendlyName, currency, tag
  • state"ACTIVE", "MANAGED", "DESTROYED"
  • state.blockedReason"USER", "SYSTEM"
  • type"VIRTUAL", "PHYSICAL"
  • mode"PREPAID", "DEBIT"
  • renewalType"RENEW", "NO_RENEW"
  • createdFrom, createdTo — epoch milliseconds

Important notes

  • Amounts in minor units (1000 = £10.00).
  • Use "userId" (not the deprecated "linkedUserId" inside threeDSecureAuthConfig) to assign a card to a specific user at creation.

Summary

Functions

Blocks a managed card.

Creates a new managed card.

Creates spend rules for a managed card. POST /managed_cards/{id}/spend_rules.

Removes all spend rules from a managed card. DELETE /managed_cards/{id}/spend_rules.

Destroys (permanently removes) a managed card.

Fetches a managed card by id. GET /managed_cards/{id}.

Gets the spend rules for a managed card. GET /managed_cards/{id}/spend_rules.

Lists all managed cards for the authenticated identity.

The confirmed physical card fulfilment states.

Returns the transaction statement for a managed card.

Unblocks a managed card. POST /managed_cards/{id}/unblock.

Updates a managed card's details. PATCH /managed_cards/{id}.

Updates individual spend rules for a managed card. PUT /managed_cards/{id}/spend_rules.

Upgrades a virtual card to a physical card, triggering fulfilment.

Functions

block(config, id, opts \\ [])

@spec block(Weavr.Config.t(), String.t(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Blocks a managed card.

POST /managed_cards/{id}/block — sets state.blockedReason to "USER", which can be reversed by unblock/3.

create(config, attrs, opts \\ [])

@spec create(Weavr.Config.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Creates a new managed card.

POST /managed_cards

Required fields in attrs:

  • "profileId" — from Multi Portal > API Credentials
  • "friendlyName" — display name
  • "currency" — ISO 4217 code
  • "cardholderMobileNumber" — object with "countryCode" and "number"
  • for debit mode: "parentManagedAccountId", "cardLevelClassification": "DEBIT"

Optional: "nameOnCard", "tag", "userId" (assign to a specific user), "threeDSecureAuthConfig", "renewalType".

create_spend_rules(config, id, attrs, opts \\ [])

@spec create_spend_rules(Weavr.Config.t(), String.t(), map(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Creates spend rules for a managed card. POST /managed_cards/{id}/spend_rules.

delete_spend_rules(config, id, opts \\ [])

@spec delete_spend_rules(Weavr.Config.t(), String.t(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Removes all spend rules from a managed card. DELETE /managed_cards/{id}/spend_rules.

destroy(config, id, opts \\ [])

@spec destroy(Weavr.Config.t(), String.t(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Destroys (permanently removes) a managed card.

DELETE /managed_cards/{id} — irreversible.

get(config, id, opts \\ [])

@spec get(Weavr.Config.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Fetches a managed card by id. GET /managed_cards/{id}.

get_spend_rules(config, id, opts \\ [])

@spec get_spend_rules(Weavr.Config.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Gets the spend rules for a managed card. GET /managed_cards/{id}/spend_rules.

list(config, opts \\ [])

@spec list(
  Weavr.Config.t(),
  keyword()
) :: {:ok, map()} | {:error, Weavr.Error.t()}

Lists all managed cards for the authenticated identity.

GET /managed_cards — pass filters in opts[:filters].

manufacturing_states()

@spec manufacturing_states() :: [String.t()]

The confirmed physical card fulfilment states.

statement(config, id, opts \\ [])

@spec statement(Weavr.Config.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Returns the transaction statement for a managed card.

GET /managed_cards/{id}/statement — pass filters in opts[:filters]. Supports offset, limit, orderByTimestamp, fromTimestamp, toTimestamp, showFundMovementsOnly, singleEntryPerTransaction.

unblock(config, id, opts \\ [])

@spec unblock(Weavr.Config.t(), String.t(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Unblocks a managed card. POST /managed_cards/{id}/unblock.

update(config, id, attrs, opts \\ [])

@spec update(Weavr.Config.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Updates a managed card's details. PATCH /managed_cards/{id}.

update_spend_rules(config, id, attrs, opts \\ [])

@spec update_spend_rules(Weavr.Config.t(), String.t(), map(), keyword()) ::
  :ok | {:error, Weavr.Error.t()}

Updates individual spend rules for a managed card. PUT /managed_cards/{id}/spend_rules.

upgrade_to_physical(config, id, attrs, opts \\ [])

@spec upgrade_to_physical(Weavr.Config.t(), String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Weavr.Error.t()}

Upgrades a virtual card to a physical card, triggering fulfilment.

POST /managed_cards/{id}/physical — fulfilment state changes are reported via the managed_cards_physical_cards_upgrade_watch webhook. Pass delivery address and other physical card config in attrs.