API reference

Medusa

The Orboni payment provider adds crypto to a Medusa store. The buyer chooses Orboni at the payment step and pays on Orboni’s payment page, picking a coin and paying from any wallet or exchange. The money goes to the wallets you set in the dashboard, and Medusa places and captures the order once the payment is final — through the buyer’s return or the webhook, whichever comes first.

It is a payment module provider for Medusa 2.5 and later, tested end to end on Medusa 2.23. It is free, and its source is open, under the MIT licence: orboni/medusa-plugin-orboni on GitHub, medusa-plugin-orboni on npm.

Set it up

npm install medusa-plugin-orboni

In medusa-config.ts, add it to the Payment Module’s providers:

module.exports = defineConfig({
  // …
  modules: [
    {
      resolve: '@medusajs/medusa/payment',
      options: {
        providers: [
          {
            resolve: 'medusa-plugin-orboni/providers/orboni',
            id: 'orboni',
            options: {
              apiKey: process.env.ORBONI_API_KEY,
              webhookSecret: process.env.ORBONI_WEBHOOK_SECRET,
              successUrl: 'https://shop.example.com/checkout/orboni-return',
              cancelUrl: 'https://shop.example.com/checkout?step=payment',
            },
          },
        ],
      },
    },
  ],
})
  1. 1In the Orboni dashboard, set the wallets you want to be paid to under Wallets, and copy a secret key under Developers → API keys — a test key (sk_test_…) first — into ORBONI_API_KEY.
  2. 2Under Developers → Webhooks, add an endpoint at https://<your Medusa backend>/hooks/payment/orboni_orboni with the checkout.session.* events, and put its signing secret (whsec_…) into ORBONI_WEBHOOK_SECRET.
  3. 3Restart Medusa. In the admin, open Settings → Regions, edit each region that should take crypto and add Orboni (pp_orboni_orboni) to its payment providers.
  4. 4Send the buyer to the payment page from your storefront (below), place an order, and on its payment page, signed in to the dashboard, press Simulate payment: the order is placed and captured. Then swap in your live key (sk_live_…) and the live endpoint’s secret. The key decides test or live at Orboni.

The storefront

Orboni is a redirect payment: the storefront sends the buyer to the payment page and completes the cart when they come back. With the Medusa JS SDK:

// The payment step: the buyer chose Orboni.
const { payment_collection } = await sdk.store.payment.initiatePaymentSession(cart, {
  provider_id: 'pp_orboni_orboni',
  data: {
    success_url: `${origin}/checkout/orboni-return?cart_id=${cart.id}`,
    email: cart.email, // a guest's email, for Orboni's receipt
  },
})
const session = payment_collection.payment_sessions.find(
  (s) => s.provider_id === 'pp_orboni_orboni',
)
window.location.href = session.data.url

// /checkout/orboni-return: back from the payment page.
const result = await sdk.store.cart.complete(cartId)
if (result.type === 'order') {
  // Paid, or on its way: show the order.
} else {
  // Not paid yet: back to the payment step, to pay or choose another way.
}

success_url, cancel_url and email in data are optional: without them the provider’s successUrl and cancelUrl options are used, and a signed-in customer’s email is sent by itself. The session’s data carries its id, page address, status and amount, nothing secret.

How orders move

The provider reads the payment back from Orboni before Medusa acts on it, so a webhook sent twice, late or out of order changes nothing. Without the webhook a payment still places its order once the buyer comes back; a buyer who pays and closes the tab needs it, so set it up all the same.

PaymentOrboni saysIn Medusa
Paid in fullcomplete, paidThe order placed, its payment captured — from the cart’s completion or the checkout.session.completed webhook, whichever comes first
On the chain, not final yet; or held for your reviewprocessing, heldCompleting the cart places the order awaiting its payment; the webhook captures it once paid
Part paidpartially_paidNo order; the payment page asks the buyer for the rest
Not paidopen, unpaidNo order; the cart stays, and the buyer can pay or choose another way
Ran out unpaidexpiredNo order

A changed cart total or another way to pay closes the old payment page and opens a new one for the new total.

Options

apiKeystring
Required. sk_test_… or sk_live_…; the key decides test or live.
webhookSecretstring or list
The endpoint’s whsec_…, or a list of them while you roll one.
successUrl, cancelUrlstring
Where the payment page sends the buyer, unless the storefront passes its own.
paymentMethodslist
The coins offered, as usdt_tron or btc; every coin with a wallet if left out.
expiresIninteger
Seconds the page stays open; Orboni’s default if left out.
customerEmailCollectionstring
required, optional or off: whether the page asks for an email.
descriptionstring
The line the payment page shows; Orboni’s default if left out.

Good to know

  • The currency: the cart’s own — US dollars, euros, pounds, yen or any other currency a checkout session takes (Currencies in the API reference). The payment page shows the total in it, and the buyer pays its worth in the coin they pick. In a currency Orboni does not take, starting the payment fails with a reason, and the buyer chooses another way.
  • The least is worth $1.00. Below it starting the payment fails with Orboni’s reason.
  • Refunds: the money is in your wallet, so send it back from there. A refund in Medusa’s admin is recorded in Orboni; nothing moves by itself.
  • Several Medusa stores can share one Orboni project: each adds its own endpoint, and a store passes over a session it did not make.
  • Errors from Orboni reach Medusa with Orboni’s own message, as “Orboni: …”; a webhook refused for its signature is written to Medusa’s log.

What the provider sends

Each payment session makes a checkout session through POST /v1/checkout/sessions, with Medusa’s own idempotency key, so a retry never makes a second one.

amountinteger
The payment collection’s amount, in the currency’s smallest unit: cents, or whole yen.
currencystring
The cart’s currency, in lower case: usd, eur, jpy…
client_reference_idstring
Medusa’s payment session id: “payses_…”.
metadataobject
medusa_session_id, the same id, which the webhook is matched by.
customer_emailstring
A signed-in customer’s email, or the one the storefront passed; where Orboni sends the receipt when your project sends receipts.
success_url, cancel_urlstring
The storefront’s, or the options’.

No address, phone number or cart lines are sent. A payment in the dashboard, an export or a webhook leads to its Medusa payment session by client_reference_id, and the session’s data keeps Orboni’s id.

This page as Markdown, for a program or an AI assistant: /docs/medusa.md. Something missing or unclear? Write to us from the dashboard’s Help & Support.