Hex.pm CI License GitHub Sponsors Buy Me a Coffee Discord

Mishka Pay

A payment SDK for Elixir: one API for Stripe and PayPal, providers as plugins, with or without Ash.

Website · Documentation · Capabilities · Discord · Hire us

📖 What is Mishka Pay?

Mishka Pay is a payment SDK for Elixir and Phoenix. Checkouts, payments, refunds, subscriptions, customers and verified webhooks get one shape, whatever the provider. You call MishkaPay.checkout/1 and get a checkout, from Stripe or from PayPal.

It is built so one install can serve many sites, each taking its own payments, as Mishka CMS does. It works the same in any Phoenix or plain Elixir project.

✨ Why Mishka Pay

🚀 Get started

Follow Get Started. In short, in a Phoenix project on Elixir 1.20 or newer:

mix igniter.install mishka_pay

It adds the package, the plugin registry, a keys plugin, the webhook endpoint before Plug.Parsers and the test setup. Add --ash for the Ash resources and --pubsub for broadcasts. To set it up by hand, add the package to mix.exs. A pre-release is matched only when you name it:

{:mishka_pay, "~> 0.0.1"}

Give it a sandbox key and sell:

export STRIPE_SECRET_KEY=sk_test_...
{:ok, checkout} =
  MishkaPay.checkout(%{
    provider: "stripe",
    items: [%{name: "Elixir ebook", amount: %{amount: "19.99", currency: "USD"}}],
    success_url: url(~p"/thanks") <> "?session_id={CHECKOUT_SESSION_ID}",
    cancel_url: url(~p"/cart"),
    reference: order.id
  })

redirect(conn, external: checkout.url)

When the buyer comes back, read the payment with MishkaPay.fetch_checkout/3 and MishkaPay.fetch_payment/3 before you give access.

📚 Documentation

Short guides also ship with the package in guides/, and every module has its own docs on HexDocs.

🛍️ The demo shop

examples/shop is a Phoenix shop on your Stripe sandbox that shows every feature. With PayPal sandbox keys it takes PayPal too. Each part of the page carries a data-testid for browser tests.

📰 Read more

💬 Community and support

💖 Support the project

Mishka Pay is free and open source. You can support its development through GitHub Sponsors or Buy Me a Coffee.

📜 License

Apache License 2.0. See LICENSE.