X402.Client.Hooks.Default (X402 v0.9.0)

Copy Markdown View Source

Default no-op implementation of X402.Client.Hooks.

Every callback returns {:cont, context} so payment creation proceeds unchanged.

Summary

Functions

Continues after payment creation without changes.

Continues payment creation without changes.

Continues failure handling without changes.

Functions

after_payment(context, metadata)

(since 0.9.0)
@spec after_payment(X402.Client.Hooks.Context.t(), map()) ::
  {:cont, X402.Client.Hooks.Context.t()}

Continues after payment creation without changes.

before_payment(context, metadata)

(since 0.9.0)
@spec before_payment(X402.Client.Hooks.Context.t(), map()) ::
  {:cont, X402.Client.Hooks.Context.t()}

Continues payment creation without changes.

Examples

iex> context = X402.Client.Hooks.Context.new(nil, %{"scheme" => "exact"}, [])
iex> X402.Client.Hooks.Default.before_payment(context, %{}) == {:cont, context}
true

on_payment_failure(context, metadata)

(since 0.9.0)
@spec on_payment_failure(X402.Client.Hooks.Context.t(), map()) ::
  {:cont, X402.Client.Hooks.Context.t()}

Continues failure handling without changes.