Modules
The calls a project makes to take money: open a checkout, read a payment, refund one; for a
subscription (started by a checkout in mode: :subscription) read it, cancel it, take a cancel
back and list its invoices; keep customers (create, read, update, list, delete) and open their billing
portal; save a customer's card with a checkout in mode: :setup and keep their saved payment
methods; keep coupons and promotion codes; keep a catalog of products and prices; make payment
links that sell them; end an open
checkout; list payments, subscriptions, invoices, customers, coupons, codes, products and prices
page by page (MishkaPay.Page).
A postal address: where a buyer lives for the tax (MishkaPay.TaxCalculation), or where a
checkout ships to (MishkaPay.Checkout's :shipping_address). A guarded_struct.
Mishka Pay's own processes: the task supervisor MishkaPay.Credentials.fetch/3 runs a host's
keys plugins under, so a plugin that exits, throws or hangs never takes the caller with it; the
owner of the providers' token cache (MishkaPay.Helpers.TokenCache); and the providers
(plugins/0), each a mishka_installer plugin it starts itself, as every Mishka CMS package starts
its own.
The platform's cut of a sale made for a connected account (an application fee, fee_... at
Stripe): what a checkout's :application_fee or :application_fee_percent took. Read with
MishkaPay.fetch_application_fee/3 and MishkaPay.list_application_fees/3, and given back to
the seller, all or part, with MishkaPay.refund_application_fee/4. A guarded_struct the
provider fills in.
The Ash layer, for projects that use Ash: the MishkaPay.Ash.Resource extension a host adds
to resources of its own domain and data layer, and the listeners that keep them current.
Without Ash none of it compiles, and the rest of Mishka Pay works on plain structs.
Makes a module the mishka_pay:event:process listener that syncs the customer an event is
about (customer.created, customer.updated, customer.deleted on Stripe, the
setup_intent.* and payment_method.* events of the customer's saved cards, and
customer.tax_id.* for one of its tax ids) into a customer resource (the :customer kind of
MishkaPay.Ash.Resource)
The :portal action of the :customer kind (MishkaPay.Ash.Resource): reads the row (with
the caller's actor and
tenant) and opens its provider's customer portal with MishkaPay.portal_session/1.
The :register, :sync, :edit and :remove actions of the :customer kind
(MishkaPay.Ash.Resource): asks the provider
before the action's transaction starts, writes the customer as the provider answered it, and
fires mishka_pay:customer:changed after. A customer the provider cannot give is an error on
the action, and nothing is written; one the provider deleted, by :remove or elsewhere, keeps
its row with :deleted_at.
Makes a module the mishka_pay:event:process listener that syncs the dispute an event is
about (charge.dispute.* on Stripe) into a dispute resource (the :dispute kind of
MishkaPay.Ash.Resource)
The :sync, :submit_evidence and :accept actions of the :dispute kind
(MishkaPay.Ash.Resource): asks the
provider before the action's transaction starts, writes the dispute as the provider answered
it, and fires mishka_pay:dispute:changed after. A dispute the provider cannot give is an
error on the action, and nothing is written.
After the inbox's last try: marks the event :failed and keeps why, from the :error argument
AshOban gives its on_error action, and emits [:mishka_pay, :inbox, :failed] with the event's
:provider, :tenant, :type and :event_id.
Makes a module the mishka_pay:webhook:received listener that stores each checked event in an
inbox resource (the :inbox kind of MishkaPay.Ash.Resource)
Works one inbox event: fires mishka_pay:event:process with it before the action's
transaction starts, since the listeners may call the provider, and marks it processed when
every listener took it. Otherwise it keeps the reason in :last_error and the action fails, so
its AshOban job tries again.
The change of every action of a site-managed object kind (MishkaPay.Ash.Object.Spec):
before the transaction it reads the object again (:sync), or makes or changes it at the
provider (:add, :edit, :archive, an invoice's steps), and writes what the provider
answered; after it, fires mishka_pay:<kind>:changed with %{<kind> => struct, record: record}. An object the provider deleted (a coupon, a draft bill) is kept with deleted_at.
Makes a module the mishka_pay:event:process listener that syncs the provider object an event
is about into a resource of a site-managed kind (MishkaPay.Ash.Object.Spec): a
product.updated into the :product resource, an invoice.paid into the :invoice one.
What the provider objects a site manages from its admin keep and do, kind by kind: products,
prices, coupons, promotion codes, payment links and one-off bills (the :product, :price,
:coupon, :promotion_code, :payment_link and :invoice kinds of
MishkaPay.Ash.Resource). Each kind names the provider object its webhook events are about,
how to read one again, the row it writes from the provider's answer, and the MishkaPay call
of each of its actions. MishkaPay.Ash.Object.Change and MishkaPay.Ash.Object.Listener run
them.
How a payment or a subscription row finds its user (belongs_to_user of
MishkaPay.Ash.Resource).
Makes a module the mishka_pay:event:process listener that syncs the payment an event concerns
into a payment resource (the :payment kind of MishkaPay.Ash.Resource)
The :money calculations of MishkaPay.Ash.Resource's kinds: a stored amount with its
currency, as Money.
The :refund action of the :payment kind (MishkaPay.Ash.Resource): refunds the stored
payment through its
provider before the transaction starts (as often as the tenant allows, see
MishkaPay.Refund), reads the payment again and writes it, keeps the
MishkaPay.Refund in the record's :refund metadata, and fires mishka_pay:payment:changed.
When the payment cannot be read again, the row counts the refund itself (never past the
payment's amount), and the announcement waits for the next sync.
The :start_checkout action of the :payment kind (MishkaPay.Ash.Resource):
MishkaPay.checkout/1 with Ash errors, in the action's tenant, with the actor as the
checkout's owner unless it names one (MishkaPay.Ash.Owner).
Reads a payment from its provider before the action's transaction starts and writes what the
provider said; after the transaction, fires mishka_pay:payment:changed. A payment the
provider cannot give is an error on the action, and nothing is written.
Mishka Pay's Ash layer as a resource extension: a host's resource, in its own domain and data layer, says what it keeps, and gets the attributes, identities, calculations, actions, code interface and webhook listener of that kind.
The transformer of MishkaPay.Ash.Resource: adds the resource's kind
(MishkaPay.Ash.Resource.Kinds) with Ash.Resource.Builder, before any transformer of Ash
and AshOban sees the resource, and skips whatever the host defines itself.
Reads the mishka_pay setup of a resource (MishkaPay.Ash.Resource): each option as
mishka_pay_<option>/1, such as mishka_pay_kind/1 and mishka_pay_listen?/1, the actions it
took from its kind, and the listener made for it.
The shape of each kind of MishkaPay.Ash.Resource, in one place: its attributes, identities,
calculations and actions (with their arguments, changes and options), the code interface name
of each action, the listener that keeps it current and, for the inbox, its AshOban trigger.
MishkaPay.Ash.Resource.ApplyKind adds them to a host's resource with Ash.Resource.Builder,
skipping whatever the host defines itself.
The read-only generic actions of a row, for a site's admin pages: they read the row (with the caller's actor and tenant) and ask its provider, writing nothing.
Whether a user has a subscription that gives access now: a policy check for the host's own
resources, and subscribed?/3 for code and templates. Members-only posts and files sold by
plan are its first use.
Makes a module the mishka_pay:event:process listener that syncs the subscription an event
concerns into a subscription resource (the :subscription kind of MishkaPay.Ash.Resource)
Reads a subscription from its provider before the action's transaction starts and writes what
the provider said; after the transaction, fires mishka_pay:subscription:changed. A
subscription the provider cannot give is an error on the action, and nothing is written.
The :cancel, :resume, :change, :pause and :resume_collection actions of
the :subscription kind of MishkaPay.Ash.Resource: asks the provider before
the transaction starts, writes the subscription as the provider answers it, and fires
mishka_pay:subscription:changed after.
How the Ash layer finds the tenant a provider call is for (MishkaPay.Credentials), so it
works the same in a single-site project and in a multi-tenant one like Mishka CMS.
Writes a create action's tenant (MishkaPay.Ash.Tenant.of/1) into the host's own attribute,
the tenant_from of MishkaPay.Ash.Resource, unless the action sets it itself.
The money a provider holds for the seller, read with MishkaPay.fetch_balance/2. A
guarded_struct the provider fills in.
Money paid out of an account's balance to its bank account or card (a payout, po_... at
Stripe): the platform's own, or, with a site's keys that name a connected account, the
seller's. Read with MishkaPay.fetch_payout/3 and MishkaPay.list_payouts/3, and stopped
with MishkaPay.cancel_payout/3 while it is still :pending. A guarded_struct the provider
fills in.
One movement of the seller's balance at the provider: a charge, a refund, a fee, a payout.
Listed with MishkaPay.list_balance_transactions/3, such as every one a payout paid out. A
guarded_struct the provider fills in.
Checks one site's setup before it takes money, the way a deploy or CI step would: each check is
{name, :ok | {:error, reason}}, in order, and run/1 never raises. mix mishka_pay.check
prints them.
A checkout: what the buyer pays for and where they come back to, then the provider's answer. A
guarded_struct; MishkaPay.checkout/1 builds it from a map and hands it to the provider.
The HTTP base every provider adapter builds on, over Req. A request is described as this
guarded_struct and sent with request/1
A seller's own account under a platform (a connected account, acct_... at Stripe Connect):
each site of a multi-site platform, or each seller of a marketplace, takes its money there.
Made with MishkaPay.create_connected_account/1, read with MishkaPay.fetch_connected_account/4
and MishkaPay.list_connected_accounts/3, changed with MishkaPay.update_connected_account/1
and closed with MishkaPay.close_connected_account/4. The seller fills in their details on the
provider's own pages (MishkaPay.account_link/1). A guarded_struct.
A one-time link that sends a seller to the provider's own pages for their connected account
(MishkaPay.ConnectedAccount). A guarded_struct.
A discount the provider keeps: a percent or an amount off, once, for some months of a
subscription, or forever. A guarded_struct. Buyers redeem it through a MishkaPay.Coupon.PromotionCode
they type, or a checkout applies it directly (MishkaPay.Checkout.Discounts).
A code a buyer types at the checkout (SPRING10) that applies a MishkaPay.Coupon, with its own
limits. A guarded_struct. A checkout lets buyers type codes with allow_promotion_codes: true, or
applies one itself through discounts (MishkaPay.Checkout.Discounts).
The keys of one provider for one tenant (a site, a shop, an account): the secret key, the
publishable key, the webhook secret, test or live, and whatever else the provider needs in
:extra.
A credit note: the tax-correct way to take back part or all of a finalized bill, instead of
changing it. Made with MishkaPay.create_credit_note/1 (try it first with
MishkaPay.preview_credit_note/1), read with MishkaPay.fetch_credit_note/3, listed with
MishkaPay.list_credit_notes/3 and MishkaPay.list_credit_note_lines/4, and ended with
MishkaPay.void_credit_note/3. A guarded_struct.
A buyer the provider keeps: who they are, so a returning buyer pays without typing their details again and their payments, invoices and subscriptions hang off one record. A guarded_struct.
One change of a customer's balance at the provider: store credit given, a debit added, or
credit used on a bill. Made with MishkaPay.adjust_customer_balance/5 and listed with
MishkaPay.list_customer_balance/4. A guarded_struct.
A payment method a customer saved at the provider (pm_... at Stripe), such as a card, so a
later invoice or subscription charges it without the buyer typing it again. A guarded_struct
the provider fills in.
A business buyer's tax id kept on a provider customer (txi_... at Stripe), such as an EU VAT
number. The provider prints it on the customer's invoices, and a provider that counts the tax
(Stripe Tax) may then charge no VAT and note a reverse charge. A guarded_struct.
A buyer's bank asking for a payment back (a chargeback, dp_... at Stripe). A guarded_struct
the provider fills in, read with MishkaPay.fetch_dispute/3 and MishkaPay.list_disputes/3;
answered with evidence (MishkaPay.update_dispute/1) or accepted (MishkaPay.accept_dispute/3).
A file seller usually takes back what the payment gave while a dispute is open.
The answer to a MishkaPay.Dispute, given to MishkaPay.update_dispute/1. A guarded_struct.
Every error Mishka Pay returns, built with Splode, the error library Ash is built on.
A webhook message that cannot be trusted, so nothing in it is used.
The provider refused the payment or the refund: a declined card, not enough funds, a blocked buyer.
The class of errors about wrong input. A guarded_struct validation error lands here too.
No keys for this provider and tenant.
The class of errors a provider gives: it declined, or it cannot do what was asked.
Refused by the project itself, before the provider was asked: a plugin on
mishka_pay:checkout:before said no (out of stock, a blocked buyer, a closed shop), or could not
answer, which counts as no.
The provider answered with an error that is not a decline: bad keys, a request it did not accept, a missing payment, a failure on its side after every retry.
The class of errors Mishka Pay does not know: MishkaPay.Errors.UnknownError and anything another
library raised.
Any error that is not one of Mishka Pay's own, in the :unknown class. :error holds what was
given.
No offered provider has this id.
The provider never answered, after every retry: a refused connection, a timeout, a DNS error.
The provider cannot do this operation, as its capabilities/0 says: a refund through a provider
without refunds, for example.
A provider's webhook message after its signature was checked, as MishkaPay.Webhook hands it
to the mishka_pay:webhook:received listeners. A guarded_struct the provider fills in.
Every mishka_installer event Mishka Pay fires, in one place. Code and use macros call these
functions and never write an event name by hand.
Something a customer may be entitled to use, such as "seats" or "api-access" (feat_... at
Stripe). A guarded_struct.
A customer's access to a MishkaPay.Feature right now, given by a product they bought, read
with MishkaPay.list_entitlements/4. A guarded_struct the provider fills in.
A file the provider keeps (file_... at Stripe), uploaded with MishkaPay.upload_file/1 or read
with MishkaPay.fetch_file/3. Put its :id in a dispute's evidence to send it to the bank. A
guarded_struct the provider fills in.
A public address of a MishkaPay.File, made with MishkaPay.file_link/4: anyone with :url
can open the file without a key, so a site can show it to a person, until :expires_at. A
guarded_struct the provider fills in.
A file to upload to the provider with MishkaPay.upload_file/1, such as a receipt, a download
log or a screenshot that answers a dispute. The provider keeps it and answers a
MishkaPay.File; its :id then goes in the dispute's evidence (MishkaPay.update_dispute/1).
A guarded_struct.
Default Gettext backend for Mishka Pay. It holds every message a person can see, such as the
errors on a checkout form or a refund, in the mishka_pay domain.
Runs the host plugins of a mishka_installer event so that none of them can take the caller down:
in a task under MishkaPay.TaskSupervisor, not linked to the caller, within a time limit. Used for
the keys plugins (MishkaPay.Credentials) and the checkout gate (MishkaPay.checkout/1).
Access tokens a provider gets for a site's keys (PayPal's OAuth token), kept until shortly before they expire so each call does not ask for a new one. An ETS table read and written by the callers themselves; this process only owns it, so no call ever waits on it.
One bill, as MishkaPay.list_invoices/3 lists them and MishkaPay.fetch_invoice/3 reads one; a
preview of the next one from MishkaPay.preview_subscription_change/1. A guarded_struct the
provider fills in.
A bill to make for a customer, outside any subscription, with MishkaPay.create_invoice/1: a
service sold by hand, an order paid later. The provider makes it as a draft and answers it as a
MishkaPay.Invoice; MishkaPay.finalize_invoice/3 opens it for payment,
MishkaPay.send_invoice/3 emails it, and MishkaPay.pay_invoice/4, void_invoice/3,
mark_invoice_uncollectible/3 and delete_invoice/3 end it. A guarded_struct.
One charge for a customer kept on its own, outside MishkaPay.create_invoice/1: a setup fee, an
extra seat, a late fee. Left off any bill it waits (pending) and goes on the customer's next
bill, a subscription's renewal or a one-off bill; given :invoice_id it goes on that draft
bill. Made with MishkaPay.create_invoice_item/1, changed with
MishkaPay.update_invoice_item/1, listed with MishkaPay.list_invoice_items/3 and removed
with MishkaPay.delete_invoice_item/3. A guarded_struct.
Every message a person can see, translated in the locale of the calling process: the errors of
MishkaPay.Errors and the field errors of Mishka Pay's structs. Each is looked up in the
mishka_pay domain of gettext_backend/0 when it is shown, so a form shows it in its own
locale.
A meter counts what customers use, for prices billed by usage (mtr_... at Stripe). A
guarded_struct.
One page of a list: what every MishkaPay.list_* call answers. A guarded_struct.
One payment as the provider sees it, read with MishkaPay.fetch_payment/3. A guarded_struct the
provider fills in; the provider is the source of truth, so read it again rather than keep it.
A payment the provider's fraud rules held for the seller to look at before it goes on (a
review, prv_... at Stripe Radar). A guarded_struct the provider fills in, read with
MishkaPay.fetch_fraud_review/3 and MishkaPay.list_fraud_reviews/3, and let through with
MishkaPay.approve_fraud_review/3. Refunding the payment closes it the other way.
A card issuer's early warning that a payment looks like fraud (an early fraud warning,
issfr_... at Stripe Radar), often days before the buyer's bank opens a dispute. A guarded_struct
the provider fills in, read with MishkaPay.fetch_fraud_warning/3 and
MishkaPay.list_fraud_warnings/3.
A payment the site's own page takes with the provider's card form (Stripe Elements), without a
checkout page: made on the server with MishkaPay.create_payment_intent/1, its
:client_secret handed to that buyer's browser, where the provider's script shows the form and
confirms it. Read with MishkaPay.fetch_payment_intent/3, changed before it is paid with
MishkaPay.update_payment_intent/1, confirmed on the server with
MishkaPay.confirm_payment_intent/4 (a saved payment method), and ended with
MishkaPay.cancel_payment_intent/3. A guarded_struct.
A page that sells catalog prices to anyone who opens it (https://buy.stripe.com/... at
Stripe), made once and put on a website, in an email or a QR code. A guarded_struct. Each buyer
who opens it gets their own checkout, so its sales come in like any other: checkout.session
and payment_intent webhooks, read with MishkaPay.fetch_payment/3.
A link to the provider's own billing page for one customer (Stripe's customer portal), made with
MishkaPay.portal_session/1. Send the buyer to :url; there they update their card, see their
invoices, and change or cancel their plan as the provider's settings allow, then come back to
:return_url. What they change reaches the host through its webhooks. A guarded_struct.
What buyers may do in the provider's customer portal (MishkaPay.PortalSession), kept at the
provider as one setup a portal session names by :configuration: a site can keep one for
monthly buyers and another for teams. Made with MishkaPay.create_portal_configuration/1,
changed with MishkaPay.update_portal_configuration/1, read with
MishkaPay.fetch_portal_configuration/3 and MishkaPay.list_portal_configurations/3. A
guarded_struct.
A price: one line of a checkout (what the buyer pays for, how much and how many), or a price in
the provider's catalog for a MishkaPay.Product. A guarded_struct.
Something sold, as the provider keeps it in its catalog (prod_... at Stripe), with its prices
(MishkaPay.Price with :product_id). A guarded_struct.
Every payment provider, Stripe included, implements these callbacks. A provider is one module
The contract tests every provider passes, ours and a project's own. One line runs them
What every provider adapter needs the same way, so each one keeps the same rules: idempotency
keys from a caller's own ids, the site's refund rule (MishkaPay.Credentials, :refunds), and
an :invalid error on a field. Stripe and PayPal use it; a provider a project writes can too.
PayPal as a provider: one-time payments with PayPal Orders (v2), subscriptions with billing plans, reading a payment, refunds and webhooks. A mishka_installer plugin: supervise it to install it.
Mishka Pay's structs to PayPal's request bodies, and PayPal's answers (Orders v2, captures, refunds, catalog products, billing plans, subscriptions and their transactions, webhook events) back to Mishka Pay's structs. Pure: no request is made here.
Stripe as a provider: one time payments with Stripe Checkout, reading a payment and refunds.
The only place that knows Stripe's field names: Mishka Pay's structs become Stripe's params, and
Stripe's JSON objects (API version 2026-10-28.endive) become Mishka Pay's structs.
Stripe's test clocks, to see what time does to a subscription in a sandbox: a trial that ends, a renewal that is paid or fails, retries that run out. A customer made on a clock lives on its time; moving the clock forward makes Stripe run everything that would have happened by then.
A site's webhook endpoint in its Stripe account, set from code instead of the Dashboard, with
the events Mishka Pay acts on. mix mishka_pay.stripe.webhook_endpoint runs it.
Broadcasts Mishka Pay's changes on the host's own Phoenix.PubSub, so a LiveView, a channel or
any process hears a payment, subscription, customer or dispute change at once. One line
One call to a provider's own API that Mishka Pay has no typed call for yet, sent with
MishkaPay.request/1. A guarded_struct.
Money given back on a payment, in full or in part, made with MishkaPay.refund/1. A
guarded_struct.
mishka_installer's plugin registry, for a project outside Mishka CMS. List it first in the
application's children, before the project's own plugins (mix igniter.install mishka_pay
does); Mishka Pay's application starts the providers, which register as soon as it is up
A payment method saved for later on the site's own page, with the provider's card form (Stripe
Elements) and no charge: made on the server with MishkaPay.create_setup_intent/1, its
:client_secret handed to that buyer's browser, where the provider's script shows the form and
confirms it. Read with MishkaPay.fetch_setup_intent/3, confirmed on the server with
MishkaPay.confirm_setup_intent/4, and ended with MishkaPay.cancel_setup_intent/3. Once it
succeeded, its :payment_method_id is on the customer: MishkaPay.list_payment_methods/3
lists it. A guarded_struct.
A way to ship an order and what it costs (shr_... at Stripe): kept by the provider with
MishkaPay.create_shipping_rate/1 and offered by its id, or given inline on one checkout. The
buyer picks one on the checkout's page (MishkaPay.Checkout's :shipping_rates). A
guarded_struct.
One subscription as the provider sees it, read with MishkaPay.fetch_subscription/3. A
guarded_struct the provider fills in; the provider is the source of truth, so read it again
rather than keep it.
A change to a running subscription: a new plan, a new quantity (seats), or both, and how the
provider bills the difference. A guarded_struct, given to MishkaPay.change_subscription/1 and
MishkaPay.preview_subscription_change/1.
A plan for a subscription over time, in phases (MishkaPay.Subscription.Schedule.Phases): a change of
plan on a set date, an intro price, a membership that stops after twelve months. Made with
MishkaPay.create_subscription_schedule/1, read with MishkaPay.fetch_subscription_schedule/3
and MishkaPay.list_subscription_schedules/3, changed with
MishkaPay.update_subscription_schedule/1, and ended with
MishkaPay.release_subscription_schedule/3 (the subscription goes on alone) or
MishkaPay.cancel_subscription_schedule/4 (the subscription ends too). A guarded_struct.
The tax on a sale made outside the provider's checkout, counted by the provider (Stripe Tax):
a site that charges with its own form, or sells on an invoice it makes itself, asks
MishkaPay.calculate_tax/1 what tax to add, shows it, charges the total, then reports the sale
with MishkaPay.record_tax/4. A guarded_struct.
A sale reported to the provider's tax records from a MishkaPay.TaxCalculation, with
MishkaPay.record_tax/4: the provider then counts its tax in the site's tax reports and
filings. A guarded_struct the provider fills in.
A tax rate the seller sets by hand (txr_... at Stripe), such as 19% German VAT: the provider
adds it to the lines it is put on, without counting the tax itself as Stripe Tax does. A
guarded_struct, made with MishkaPay.create_tax_rate/1, read with MishkaPay.fetch_tax_rate/3
and MishkaPay.list_tax_rates/3, and changed with MishkaPay.update_tax_rate/1.
A site's tax settings at a provider that counts the tax (Stripe Tax): where the business is and
what a price without its own tax fields counts as. A guarded_struct, read with
MishkaPay.fetch_tax_settings/2 and changed with MishkaPay.update_tax_settings/1, which sends
only the fields given.
Where the seller is registered to collect tax (taxreg_... at Stripe Tax): a provider that
counts the tax (automatic tax, MishkaPay.calculate_tax/1) charges it only where the seller is
registered. A guarded_struct, added with MishkaPay.create_tax_registration/1, listed with
MishkaPay.list_tax_registrations/3 and ended with MishkaPay.expire_tax_registration/4. A
provider never deletes one.
Helpers for a project's tests, the way Igniter.Test helps test a task: start a provider, give
keys, answer HTTP calls, without a real provider and without sleeping.
The keys MishkaPay.Test.put_keys/3 feeds. MishkaPay.Credentials.fetch/3 reads them before
any keys plugin: a test's own keys answer first, and the project's plugins answer the rest. It is
a table, not a plugin, so a project's plugin registry holds nothing of the test kit's.
A stand-in for PayPal's REST API for a project's tests: it answers in PayPal's own shapes
(Orders v2, captures, refunds, catalog products, billing plans, subscriptions and their
transactions, OAuth, webhook verification), so a host tests its PayPal flows with no keys and
no network. Mishka Pay's own PayPal tests run on it, and its sandbox tests check it against
PayPal (mix test --only paypal_live).
Money the platform sends from its own balance to a seller's connected account (a transfer,
tr_... at Stripe): the seller's share of a sale the platform took, or any payment to them.
Made with MishkaPay.create_transfer/1, read with MishkaPay.fetch_transfer/3 and
MishkaPay.list_transfers/3, and taken back, all or part, with MishkaPay.reverse_transfer/4.
A guarded_struct.
One report of what a customer used, sent with MishkaPay.report_usage/1 to the
MishkaPay.Meter that counts its :event_name. A price on that meter bills it at the end of
the period. A guarded_struct.
Takes back one usage report sent by mistake, with MishkaPay.cancel_usage/1: the meter then
counts it as if it was never reported. A guarded_struct.
What a meter counted for one customer over a window of time, read with
MishkaPay.usage_summary/6. A guarded_struct the provider fills in.
Receives the webhooks providers send, as a Plug. It reads the raw body, finds the provider (and the
tenant) from the path, lets the provider check the signature with the tenant's webhook secret,
and hands the checked MishkaPay.Event to the mishka_pay:webhook:received listeners
(MishkaPay.Events.webhook_received/0). It does no work of its own.
Mix Tasks
Runs MishkaPay.Check for one site and prints each check; fails when one does not pass, for a
deploy or CI step. The project starts, for its keys plugin and listeners.
Sets a Phoenix project up to take payments with Mishka Pay.
Reads a tenant's events from its provider since a time and hands each to the project's
mishka_pay:webhook:received listeners, oldest first (MishkaPay.replay_events/3): the Ash
inbox stores the ones it does not have and works them as if the webhook had come. Run it after
an outage. The project starts, for its keys and listeners.
Compares the Stripe API version every request is pinned to
(MishkaPay.Providers.Stripe.version/0) with the version of Stripe's newest published OpenAPI
spec (MishkaPay.Providers.Stripe.latest_version/0). It fails when they differ, so a scheduled
CI job notices when Stripe moves; then read https://docs.stripe.com/changelog, move the pin and
run the tests against Stripe.
Deletes a tenant's Stripe test clocks older than a number of hours; Stripe deletes each clock's
customers and subscriptions with it. Test keys only (MishkaPay.Providers.Stripe.TestClock
refuses live ones). The keys come from the project's own keys plugin, so the project starts.
Sets a site's webhook endpoint in its Stripe account
(MishkaPay.Providers.Stripe.WebhookEndpoint): makes it with every event Mishka Pay acts on,
or adds the events it lacks. With --check it changes nothing and fails when events are
missing, for a CI or deploy check. The project starts, for the site's keys.