Capabilities by provider
v0.0.1
A provider lists the capabilities it has, and a call to anything else answers MishkaPay.Errors.Unsupported before a request is sent. This page lists every capability, what it adds and which of the two shipped providers has it, so you can tell what works before you write code. Code that runs on Mishka CMS can ask the same question at runtime with MishkaPay.Provider.capable/2. Checked against version 0.0.1.
Capabilities
| Capability | What it adds | Stripe | PayPal |
|---|---|---|---|
:checkout | A hosted checkout, checkout/1, fetch_checkout/3, fetch_payment/3 | Yes | Yes |
:embedded_checkout | ui_mode: :embedded | Yes | No |
:capture | capture: :manual, capture_payment/4, cancel_payment/3 | Yes | No |
:expire | expire_checkout/3 | Yes | No |
:intent | Payment and setup intents for your own card form | Yes | No |
:payment_list | list_payments/3 | Yes | No |
:refund | refund/1 | Yes | Yes |
:refund_read | fetch_refund/3, list_refunds/3 | Yes | No |
:subscription | Subscription checkout, fetch_subscription/3, cancel, resume, list_invoices/3, upcoming_invoice/3 | Yes | Partly (see below) |
:subscription_change | change_subscription/1, preview_subscription_change/1, pause and resume collection | Yes | No |
:subscription_list | list_subscriptions/3, search_subscriptions/3 | Yes | No |
:subscription_schedule | Subscription schedules | Yes | No |
:invoice | create_invoice/1 and finalize, send, pay, void, mark uncollectible, delete | Yes | No |
:invoice_item | Invoice items | Yes | No |
:credit_note | Credit notes | Yes | No |
:customer | Customers | Yes | No |
:tax_id | Customer tax ids | Yes | No |
:tax | calculate_tax/1, record_tax/4 | Yes | No |
:tax_rate | Tax rates by hand | Yes | No |
:tax_setup | Tax registrations and settings | Yes | No |
:shipping | Shipping countries and rates | Yes | No |
:portal | Billing portal sessions and configurations | Yes | No |
:payment_method | Saved cards, mode: :setup | Yes | No |
:discount | Coupons and promotion codes | Yes | No |
:catalog | Products and prices | Yes | No |
:payment_link | Payment links | Yes | No |
:dispute | Fetch, list, update and accept disputes | Yes | No |
:fraud | Early fraud warnings and fraud reviews | Yes | No |
:file | Upload files, file links | Yes | No |
:usage | Meters, usage reports and summaries | Yes | No |
:entitlement | Features and entitlements | Yes | No |
:balance | Balance and balance transactions | Yes | No |
:customer_balance | A customer's credit balance | Yes | No |
:connect | Connected accounts, links, application fees, destination and on_behalf_of | Yes | No |
:transfer | Transfers and reversals | Yes | No |
:payout | Payouts | Yes | No |
:webhook | Verified webhooks | Yes | Yes |
:event_list | list_events/3, replay_events/3 | Yes | No |
:raw_request | request/1 to any path of the provider's API | Yes | Yes |
Stripe has all 39 capabilities. PayPal has five: :checkout, :refund, :subscription, :webhook and :raw_request.
Ask in code
elixir
MishkaPay.Provider.all()
MishkaPay.Provider.capable("paypal", :capture)
#=> {:error,
#=> %MishkaPay.Errors.Unsupported{
#=> provider: "paypal",
#=> operation: :capture
#=> }}capable/2 answers {:ok, module} when the provider has the capability, or an UnknownProvider or Unsupported error. MishkaPay.Provider.operations/1 lists the functions a capability needs.
What PayPal does inside a capability
- Subscription. One price per subscription. Cancel only with
at: :now.resume_subscription/3and a bill read by id are refused. A subscription is read withfetch_subscription/3and its bills withlist_invoices/3. - Checkout. PayPal refuses the options that need a capability it lacks: discounts, promotion codes, automatic tax, tax ids, an invoice, merchant of record, metadata and an expiry.
- Webhook. PayPal webhooks are checked by PayPal's own API, so they cannot be simulated locally. In tests,
MishkaPay.Test.PayPal.stub!()answers that check.
Next steps
- Take payments with PayPal: what the adapter does.
- How Mishka Pay works: providers and capabilities as plugins.
- Keys and options: per-site settings for each provider.