Parser and normalizer for the discovery specification's x-payment-info extension.
Both the single-offer shorthand and the multi-offer form are accepted. The
normalized result always uses the multi-offer offers array recommended for
newly published discovery documents.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
parse | 1 | Parse x-payment-info and normalize single-offer shorthand into the multi-offer array form. | payment_info: value |
Summary
Functions
Parse x-payment-info and normalize single-offer shorthand into the multi-offer array form.
Types
Functions
Parse x-payment-info and normalize single-offer shorthand into the multi-offer array form.
Parameters
payment_info- JSON-compatible x-payment-info map (value)
Returns
{:ok, %{"offers" => offers}} or {:error, reason} (tagged_tuple)
Errors
:invalid_payment_info:mixed_offer_forms:empty_offers:invalid_offer
# descripex:contract
%{
params: %{
payment_info: %{
description: "JSON-compatible x-payment-info map",
kind: :value
}
},
errors: [:invalid_payment_info, :mixed_offer_forms, :empty_offers,
:invalid_offer],
returns: %{
type: :tagged_tuple,
description: "`{:ok, %{\"offers\" => offers}}` or `{:error, reason}`"
}
}