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

CapabilityWhat it addsStripePayPal
:checkoutA hosted checkout, checkout/1, fetch_checkout/3, fetch_payment/3YesYes
:embedded_checkoutui_mode: :embeddedYesNo
:capturecapture: :manual, capture_payment/4, cancel_payment/3YesNo
:expireexpire_checkout/3YesNo
:intentPayment and setup intents for your own card formYesNo
:payment_listlist_payments/3YesNo
:refundrefund/1YesYes
:refund_readfetch_refund/3, list_refunds/3YesNo
:subscriptionSubscription checkout, fetch_subscription/3, cancel, resume, list_invoices/3, upcoming_invoice/3YesPartly (see below)
:subscription_changechange_subscription/1, preview_subscription_change/1, pause and resume collectionYesNo
:subscription_listlist_subscriptions/3, search_subscriptions/3YesNo
:subscription_scheduleSubscription schedulesYesNo
:invoicecreate_invoice/1 and finalize, send, pay, void, mark uncollectible, deleteYesNo
:invoice_itemInvoice itemsYesNo
:credit_noteCredit notesYesNo
:customerCustomersYesNo
:tax_idCustomer tax idsYesNo
:taxcalculate_tax/1, record_tax/4YesNo
:tax_rateTax rates by handYesNo
:tax_setupTax registrations and settingsYesNo
:shippingShipping countries and ratesYesNo
:portalBilling portal sessions and configurationsYesNo
:payment_methodSaved cards, mode: :setupYesNo
:discountCoupons and promotion codesYesNo
:catalogProducts and pricesYesNo
:payment_linkPayment linksYesNo
:disputeFetch, list, update and accept disputesYesNo
:fraudEarly fraud warnings and fraud reviewsYesNo
:fileUpload files, file linksYesNo
:usageMeters, usage reports and summariesYesNo
:entitlementFeatures and entitlementsYesNo
:balanceBalance and balance transactionsYesNo
:customer_balanceA customer's credit balanceYesNo
:connectConnected accounts, links, application fees, destination and on_behalf_ofYesNo
:transferTransfers and reversalsYesNo
:payoutPayoutsYesNo
:webhookVerified webhooksYesYes
:event_listlist_events/3, replay_events/3YesNo
:raw_requestrequest/1 to any path of the provider's APIYesYes

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/3 and a bill read by id are refused. A subscription is read with fetch_subscription/3 and its bills with list_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