One Elixir API for Stripe and PayPal: Meet Mishka Pay
Mishka Pay is an open source payment SDK for Elixir, Phoenix and Ash: one set of calls for Stripe and PayPal, keys per site, verified webhooks and a test kit.
Mishka Pay, the Elixir and Ash payment SDK, gives a Phoenix app one set of calls for Stripe and PayPal: checkouts, refunds, subscriptions and verified webhooks. It is open source under Apache-2.0, and we built it for Mishka CMS, where every site takes payments with its own keys.
Mishka Pay and Mishka CMS are free. A founding seat pays for the time we spend on them, and it gives you lifetime access to Mishka CMS, priority support and every paid extension we release. The details are in Mishka CMS lifetime access for $250.
What is Mishka Pay?
Mishka Pay is a payment SDK for Elixir. Your code calls MishkaPay.checkout/1 or MishkaPay.refund/1, names the provider and the site, and gets the same structs and the same typed errors back whether Stripe or PayPal answered.
It works on its own with plain structs, or with Ash, where it keeps payments, subscriptions, customers and disputes in your own resources and updates them from webhooks. Stripe is the full provider. PayPal covers checkout, refunds, subscriptions and webhooks.
Why we built Mishka Pay
Mishka CMS runs many sites from one install, and each site needs its own Stripe or PayPal account. The payment code had to read keys per site at runtime, speak to more than one provider, and keep its state in the same Ash resources as the rest of the CMS.
When we looked at Hex, every maintained payment library we found spoke to one provider. stripity_stripe and tiger_stripe cover Stripe, and the paypal package covers PayPal. gringotts puts six gateways behind one API, but PayPal is not one of them, and its last release on Hex was in February 2023. ash_billing is the closest to what we wanted, since it lives in Ash resources, and today its only provider is Stripe.
Other languages already have this. Rails has Pay, with Stripe, Paddle, Braintree and Lemon Squeezy behind one set of models, and Laravel has Cashier for Stripe. We wanted the same for Elixir, built like the rest of Mishka: providers as plugins, structs from GuardedStruct, and an Ash layer you can leave out.
Mishka releases. Once a month.
New Mishka CMS releases, Elixir and Phoenix patterns, and case studies from the team. No spam, unsubscribe anytime.
Your first payment in two calls
Install it with Igniter. The task adds the Stripe provider, a keys plugin, the webhook endpoint before Plug.Parsers and the test config:
mix igniter.install mishka_payAdd --ash for the Ash layer. You can also add {:mishka_pay, "~> 0.0.1"} to your deps and follow the steps to install Mishka Pay in a Phoenix app by hand.
The first call opens a checkout and sends the buyer to the provider's page:
{:ok, checkout} =
MishkaPay.checkout(%{
provider: "stripe",
tenant: site_id,
items: [
%{
name: "Elixir ebook",
amount: %{amount: "19.99", currency: "USD"}
}
],
success_url:
"https://shop.example/thanks" <>
"?session_id={CHECKOUT_SESSION_ID}",
cancel_url: "https://shop.example/cart",
reference: "order-1001"
})
redirect(conn, external: checkout.url)reference is your order id. The same reference never opens two checkouts, and it comes back on the payment. When the buyer returns, read the payment back before you hand anything over:
# payment_id comes from the webhook,
# or from fetch_checkout/3 on your thanks page
{:ok, %MishkaPay.Payment{status: :paid}} =
MishkaPay.fetch_payment("stripe", payment_id, site_id)To try it, put a Stripe Sandbox's test keys in your keys plugin and pay with the card 4242 4242 4242 4242, any future date and any three-digit CVC, as Stripe's test cards list them. Change provider to "paypal" and the same two calls run against PayPal.
For a payment form inside your own page, pass ui_mode: :embedded with a return_url, and Stripe shows its embedded checkout. The guide to take a one-time payment covers discounts, shipping and both kinds of checkout page.

One payment from the call to your rows. Without Ash, your code reads the payment back itself.
Many sites, each with its own keys
Mishka Pay never reads keys from config.exs. A keys plugin answers them at runtime for each provider and site, so a site can change its keys without a restart:
defmodule MyApp.Pay.Keys do
use MishkaPay.Credentials
@impl MishkaPay.Credentials
def credentials("stripe", site_id) do
case MyApp.Sites.payment_settings(site_id) do
%{stripe_secret_key: key} = s when is_binary(key) ->
%{
secret_key: key,
webhook_secret: s.stripe_webhook_secret
}
_no_keys ->
nil
end
end
def credentials(_provider, _site_id), do: nil
endEvery call names its tenant. A site without keys gets MishkaPay.Errors.MissingCredentials and no request goes out. Each site also gets its own webhook URL, such as /pay/webhooks/stripe/shop, checked with that site's secret. The fields a keys map can hold, from mode to refunds, are listed under keys and per-call options.
This is the model Mishka CMS uses to run many sites from one install. Inside the CMS there is nothing more to set up: the core already runs the plugin registry, and an extension starts its own keys plugin.
Providers are plugins too. Stripe and PayPal are Mishka Installer plugins that implement the MishkaPay.Provider behaviour, and you can write one for your own bank or gateway. A provider lists what it can do, a gateway with no webhooks can check the payment when the buyer returns, and MishkaPay.ProviderCase runs the contract tests against your module. For how those plugins work, read about runtime plugins without a redeploy.

One install and three sites. Each has its own keys, its own webhook URL and its own rows.
Stripe and PayPal side by side
Each provider lists its capabilities, and Mishka Pay checks that list before it sends anything. Stripe answers every row in the table below. PayPal answers hosted checkout, refunds, subscriptions, webhooks and a raw call to its REST API, and anything else comes back as an error with no request made:
MishkaPay.resume_subscription(
"paypal",
subscription_id,
site_id
)
#=> {:error,
#=> %MishkaPay.Errors.Unsupported{provider: "paypal", ...}}A PayPal checkout is a PayPal Order. When the buyer comes back, Mishka Pay captures an approved Order once, on the first read. Webhooks are verified by a call to PayPal's own API. A subscription has one price with an interval and an optional free trial, and it can be canceled right away, since PayPal has no cancel at the end of the period.
The PayPal adapter guide lists every refusal, and capabilities by provider has the full table.

What each provider answers in Mishka Pay today.
Subscriptions, refunds, webhooks, Connect and tests
On Stripe, Mishka Pay pins the newest API version, and mix mishka_pay.stripe.check_version fails when Stripe publishes a newer one.
Subscriptions
A subscription is a checkout with mode: :subscription and items with an interval, plus trial_days for a free trial:
MishkaPay.checkout(%{
provider: "stripe",
tenant: site_id,
mode: :subscription,
trial_days: 14,
items: [
%{
name: "Pro",
amount: %{amount: "20", currency: "USD"},
interval: :month
}
],
success_url: "https://club.example/welcome",
cancel_url: "https://club.example/plans",
reference: "member-42"
})On Stripe you can preview a plan change with preview_subscription_change/1 before you make it, pause collection, cancel at the end of the period and take the cancel back. The guide shows how to sell plans with trials.
Refunds and held payments
MishkaPay.refund/1 gives money back in full or in part, and the payment moves to :partially_refunded or :refunded. Each site chooses whether a payment is refunded once or many times. On Stripe, a checkout with capture: :manual only holds the money: capture_payment/4 takes all or part of it later, and cancel_payment/3 lets it go. Read how to refund or hold then capture.
Webhooks
One plug, mounted before Plug.Parsers, takes every provider's webhooks:
plug MishkaPay.Webhook, at: "/pay/webhooks"It checks each event with the site's secret and stores it once in an inbox, where an AshOban job works it with retries. You can roll a secret while the old one still verifies, and on Stripe you can replay the events a site missed. Stripe events arrive as thin events through v2 event destinations by default. The docs show how to verify signed webhooks.
Stripe Connect
One Stripe platform account can serve many sites. Mishka Pay creates connected accounts on Accounts v2, sends each seller an onboarding link, keeps an application fee on each sale and moves money with transfers. When a site's keys carry an account_id, every Stripe request acts for that account. Set up one Stripe platform for many sites.
Tests
MishkaPay.Test gives each test its own keys, answers provider calls with stubs and signs Stripe events the way Stripe does, so a test can post a webhook through the plug with no network. Tests that use only put_keys/3 and stub_http/1 can run with async: true, and MishkaPay.Test.PayPal answers like PayPal without any keys. Start with test code that takes payments.

The capability board on the Mishka Pay page, switched from Stripe to PayPal. Hatched keys are refused before any request.
What you can build with Mishka CMS
Mishka Pay ships no admin page and no storefront. It gives you the calls and the rows, and you decide what a payment unlocks. With Ash, one policy check asks whether the user has a plan:
policies do
policy action(:read) do
authorize_if {MishkaPay.Ash.Subscribed,
resource: MyApp.Pay.Subscription,
product: "prod_pro"}
end
end
MishkaPay.Ash.subscribed?(
MyApp.Pay.Subscription,
current_user,
tenant: site.id
)Access counts while the plan is :active, or :trialing until the trial ends, and each check is one query. See how to gate content by plan in Ash. Here are a few things you could build with it today, and one we plan to build ourselves:
- You could sell posts. A post in Mishka Blog, the free Phoenix LiveView blog engine, can already be locked to readers who hold a permission name, as the guide to reader locks and roles shows. A small extension could give that permission when a subscription starts, or check
subscribed?/3itself. - You could sell docs. With Mishka Document 0.0.1, the versioned docs engine, you could keep the newest version of a manual for subscribers and leave older versions open to everyone.
- You could manage payments in your admin. The rows are ordinary Ash resources, so an admin built with Mishka Gervaz lists, filters and refunds them like any other resource.
- We plan to sell files. A file seller extension for Mishka CMS, built on Mishka Pay, would sell downloads once or by plan.
How Mishka Pay compares
Most Elixir payment libraries target one provider. The table puts the ones we found next to Mishka Pay and two libraries from Ruby and PHP, using what each project's README, docs and package registry said on 18 November 2026. Each name links to the page we read.

Payment libraries side by side. "Not stated" means the project's README or docs did not say.
| Library | Providers | One API for many providers | Webhook check | Test helpers | Ash | Latest release |
|---|---|---|---|---|---|---|
| Mishka Pay (Elixir) | Stripe, PayPal | Yes | Yes, per site | Yes, MishkaPay.Test | Yes, optional | 0.0.1, new |
| stripity_stripe (Elixir) | Stripe | No | Yes, Stripe.WebhookPlug | Not stated | Not stated | 3.3.3, October 2026 |
| tiger_stripe (Elixir) | Stripe | No | Yes | Yes, HTTP stubs per process | Not stated | 0.5.0, November 2026 |
| paypal (Elixir) | PayPal | No | Not stated | Not stated | Not stated | 0.3.1, September 2026 |
| gringotts (Elixir) | Authorize.Net, CAMS, MONEI, PAYMILL, Stripe, TREXLE | Yes | Not stated | Gateways start in test mode | Not stated | 1.1.1, February 2023 |
| ash_billing (Elixir) | Stripe | A provider behaviour, Stripe only so far | Yes, with replay protection | Yes, plug-based stubs | Yes | 0.5.2, November 2026 |
| Pay (Ruby on Rails) | Stripe, Paddle, Braintree, Lemon Squeezy | Yes | Yes | Yes, a fake processor | Not applicable | 12.5.0, November 2026 |
| Laravel Cashier (PHP) | Stripe | No | Yes | Tests use Stripe test keys | Not applicable | 16.11.0, November 2026 |
Two of them come close to Mishka Pay in one area each. tiger_stripe takes a client per call and says it is safe with many API keys or connected accounts, which suits a multi-site app on Stripe. ash_billing keeps billing in Ash resources with a Spark DSL, and its provider behaviour is ready for more than Stripe. Outside Elixir, Pay for Rails reaches PayPal through Paddle and Braintree.
Status and what comes next
Version 0.0.1 is the first release of Mishka Pay, and it is ready for production with Stripe and PayPal. The code is in the mishka_pay repository on GitHub, and the package is mishka_pay on Hex.
On our side, the file seller extension above is planned on top of Mishka Pay, and we will work through the issues you open.
Mishka Pay is built on our own libraries. Its structs come from Guarded Struct (see how to validate and sanitize input with GuardedStruct), its providers and keys plugins run on Mishka Installer, and its rows fit an admin made with Gervaz, as in build an Ash admin with tables and forms. Thank you to Stripe and to the team behind PayPal Developer for their APIs and sandboxes, and to Ash Framework and Igniter, which sets a project up in one command.
Mishka releases. Once a month.
New Mishka CMS releases, Elixir and Phoenix patterns, and case studies from the team. No spam, unsubscribe anytime.
Questions people ask about Mishka Pay
Support our work
Mishka Pay is free, and a small team builds it. If you want to help us work on it full time, a founding seat gives you lifetime access to Mishka CMS, priority support and every paid extension we release.
You can also sponsor our open source work. To have our team build payments into your Phoenix app, contact us.
Shahryar Tavakkoli writes about Elixir and Phoenix LiveView: Mishka Chelekom releases, GuardedStruct validation, static sites, service workers and SEO.