KapsoEx.Platform.Funding (kapso_ex v0.1.0)

Copy Markdown View Source

WhatsApp funding and usage for Tech Providers with managed billing: funding status per WhatsApp Business Account (WABA) and portfolio, recorded charges, and stopping funding.

Usage amounts are in micro USD (customer_charge_micro_usd).

Summary

Functions

Verifies an external multi-partner solution account with Meta and ensures Kapso funds it, without waiting for Meta's webhook. Call it after Embedded Signup completes.

Gets the funding status of a WABA.

Gets the charges recorded for a WABA between start_time and end_time.

Gets the status of a funding revocation operation.

Gets the charges recorded across a portfolio's accounts between start_time and end_time.

Lists the WABAs of a business portfolio with their funding status. Params: limit, before, after.

Queues an asynchronous stop of Kapso funding for a portfolio.

Types

result()

@type result() :: {:ok, map()} | {:error, KapsoEx.Error.t()}

time()

@type time() :: DateTime.t() | String.t()

Functions

ensure_account_funding(client, waba_id, business_portfolio_id)

@spec ensure_account_funding(KapsoEx.Client.t(), String.t(), String.t()) :: result()

Verifies an external multi-partner solution account with Meta and ensures Kapso funds it, without waiting for Meta's webhook. Call it after Embedded Signup completes.

get_account_funding(client, waba_id)

@spec get_account_funding(KapsoEx.Client.t(), String.t()) :: result()

Gets the funding status of a WABA.

get_account_usage(client, waba_id, start_time, end_time)

@spec get_account_usage(KapsoEx.Client.t(), String.t(), time(), time()) :: result()

Gets the charges recorded for a WABA between start_time and end_time.

get_funding_operation(client, portfolio_id, operation_id)

@spec get_funding_operation(KapsoEx.Client.t(), String.t(), String.t()) :: result()

Gets the status of a funding revocation operation.

get_portfolio_usage(client, portfolio_id, start_time, end_time)

@spec get_portfolio_usage(KapsoEx.Client.t(), String.t(), time(), time()) :: result()

Gets the charges recorded across a portfolio's accounts between start_time and end_time.

list_portfolio_accounts(client, portfolio_id, params \\ [])

@spec list_portfolio_accounts(KapsoEx.Client.t(), String.t(), map() | keyword()) ::
  result()

Lists the WABAs of a business portfolio with their funding status. Params: limit, before, after.

revoke_portfolio_funding(client, portfolio_id, idempotency_key)

@spec revoke_portfolio_funding(KapsoEx.Client.t(), String.t(), String.t()) :: result()

Queues an asynchronous stop of Kapso funding for a portfolio.

idempotency_key (1-255 bytes) must be stable per logical request: reuse it when retrying after a network failure to get the original operation back. Follow it with get_funding_operation/3.