Skip to content

Billing 0.3.1: Online checkout for an invoice works

Billing 0.3.1 fixes online checkout for an invoice: starting a payment provider’s checkout crashed on every call, including from the “Pay with” buttons on the invoice page.

The checkout call handed the provider an options map in place of the invoice, so the provider never got its return address and failed. It now passes the invoice itself and the options, and the cancel address defaults to the success address. After a session was created, saving its details also failed, because they were written to fields the invoice does not have. The session’s id, address, provider and time are now kept in the invoice’s metadata, and a failure to save them no longer throws away the checkout address the customer is sent to.

Full release notes: Billing 0.3.1

0.3.1 · 18 May 2026

Fixed

  • PhoenixKitBilling.create_checkout_session/3 was unusable — every call crashed:
    • It called Providers.create_checkout_session/2 with a hand-built options map in the invoice position, so the provider received an empty opts keyword list and raised KeyError on success_url. It now forwards the real %Invoice{} struct and passes opts through, with :cancel_url defaulting to :success_url. The provider already derives amount, currency, line items and metadata from the invoice.
    • On success it wrote checkout_session_id / checkout_url via Ecto.Changeset.change/2, but neither field exists on the Invoice schema, raising ArgumentError: unknown field. Checkout session details are now recorded under invoice.metadata["checkout"] (provider_session_id, url, provider, created_at); persistence is best-effort and a failed update no longer discards the live session URL returned to the caller.

Billing 0.3.1. Install or update: {:phoenix_kit_billing, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.