Bazaar.DiscoveryProfile (Bazaar v0.3.0)

Copy Markdown View Source

Builder for the UCP Discovery Profile.

This is the manifest served at /.well-known/ucp that describes the merchant's capabilities, endpoints, and configuration.

Follows the UCP business profile document from https://ucp.dev: a ucp envelope with services, capabilities and payment_handlers registries keyed by reverse-domain name, plus an optional keys JWK set.

Summary

Functions

Builds a UCP-compliant discovery profile from handler module configuration.

Converts profile to JSON string.

The UCP spec version this library implements.

Functions

from_handler(handler_module, opts \\ [])

Builds a UCP-compliant discovery profile from handler module configuration.

The handler's business_profile/0 may include:

  • "name", "description", "logo_url", "support_email", "website": merchant details, exposed under a top-level merchant key
  • "payment_handlers": a list of %{"name" => "com.stripe", "id" => "stripe", "config" => %{}} entries, where name is the handler's reverse-domain namespace
  • "keys": public signing keys as a JWK set

Example

profile = Bazaar.DiscoveryProfile.from_handler(MyApp.Handler, base_url: "https://api.example.com")

to_json(profile)

Converts profile to JSON string.

version()

The UCP spec version this library implements.