Overview
Icon for Orboni

Orboni

Crypto payments to your own wallets

Orboni for Medusa

Crypto payments for Medusa v2: the buyer pays on Orboni's payment page, picking USDT, USDC, Bitcoin, Ethereum or another coin, from any wallet or exchange. The money goes straight to the wallets you set in the Orboni 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. Full guide: https://orboni.com/docs/medusa

Install

npm install medusa-plugin-orboni

In Copy to clipboardmedusa-config.ts, add it to the plugins and to the Payment Module's providers:

module.exports = defineConfig({
// …
plugins: ['medusa-plugin-orboni'],
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. In the Orboni dashboard, set your wallets under Wallets, and copy a secret key under Developers → API keys — a test key (Copy to clipboardsk_test_…) first — into Copy to clipboardORBONI_API_KEY.
  2. Under Developers → Webhooks, add an endpoint at Copy to clipboardhttps://<your Medusa backend>/hooks/payment/orboni_orboni with the Copy to clipboardcheckout.session.* events, and put its signing secret (Copy to clipboardwhsec_…) into Copy to clipboardORBONI_WEBHOOK_SECRET.
  3. Restart Medusa. In the admin, open Settings → Regions, edit each region that should take crypto and add Orboni (Copy to clipboardpp_orboni_orboni) to its payment providers.

The provider's id is Copy to clipboardpp_orboni_orboni (Copy to clipboardpp_orboni_<id> for another Copy to clipboardid).

The Copy to clipboardplugins line adds a scheduled job, Copy to clipboardorboni-check-payments, which Medusa runs in its worker every 15 minutes. Medusa answers Orboni's webhook before it records anything, so a payment that fails while it is recorded is not sent again. The job finishes it: a paid session of the last three days with no captured payment or no order, whether its webhook was lost, Orboni or the database did not answer, or the order could not be placed. It also reads captured payments for two days, for money that left the chain. Without that line the provider works as before, but nothing finishes such a payment.

The storefront

Orboni is a redirect payment, like PayPal: the storefront sends the buyer to the payment page and completes the cart when they come back.

// 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, where the buyer can pay or choose another way.
}

Copy to clipboardsuccess_url, Copy to clipboardcancel_url and Copy to clipboardemail in Copy to clipboarddata are optional: without them the provider's Copy to clipboardsuccessUrl and Copy to clipboardcancelUrl options are used, and a signed-in customer's email is sent by itself.

How orders move

Payment Orboni says In Medusa Paid in full Copy to clipboardcomplete, paid The order placed, its payment captured — from the cart's completion or the Copy to clipboardcheckout.session.completed webhook, whichever comes first On the chain, not final yet; or held for your review Copy to clipboardprocessing, Copy to clipboardheld Completing the cart places the order awaiting its payment; the webhook captures it once paid Part paid Copy to clipboardpartially_paid No order; the payment page asks the buyer for the rest Not paid Copy to clipboardopen, unpaid No order; the cart stays, and the buyer can pay or choose another way Ran out unpaid Copy to clipboardexpired No order Money that paid it left the chain Copy to clipboardpayment_reversed The order's metadata gets Copy to clipboardorboni: not to ship it until the Orboni dashboard shows it paid again; a line in the server's log too. When it is paid in full again, the note says so

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. A paid session Medusa did not finish is finished by the scheduled job within 15 minutes. A changed cart total or another way to pay closes the old payment page and opens a new one for the new total.

Options

Option Copy to clipboardapiKey required Copy to clipboardsk_test_… or Copy to clipboardsk_live_…; the key decides test or live Copy to clipboardwebhookSecret the endpoint's Copy to clipboardwhsec_…, or a list of them while you roll one Copy to clipboardsuccessUrl, Copy to clipboardcancelUrl where the payment page sends the buyer, unless the storefront passes its own Copy to clipboardpaymentMethods the coins offered, as Copy to clipboard['usdt_tron', 'btc']; every coin with a wallet if left out Copy to clipboardexpiresIn seconds the page stays open (Orboni's default if left out) Copy to clipboardcustomerEmailCollection Copy to clipboardrequired, Copy to clipboardoptional or Copy to clipboardoff: whether the page asks for an email Copy to clipboarddescription the line the payment page shows; Orboni's default if left out

Good to know

  • The currency is the cart's: US dollars, euros, pounds, yen and any other currency a checkout session takes. In one Orboni does not take, starting the payment fails with a reason, and the buyer chooses another way.
  • Refunds: the money is in your wallet, so send it back from there. A refund in Medusa's admin is recorded in Orboni, and so is the one Medusa makes when you cancel a paid order; nothing moves by itself, so send the money first.
  • When Medusa cannot place a paid cart's order (an item ran out while the payment was on its way, say), it tries to refund the payment by itself. The provider refuses that refund, since nothing was sent back: the payment stays captured, the server's log says why, and the job places the order once what stopped it is fixed — at every check for two hours, then hourly, for three days. To give the money back instead, send it from your wallet, then refund the payment in the admin.
  • Several Medusa stores can share one Orboni project: each adds its own endpoint, and a store passes over a session it did not make.
  • Nothing about the buyer is sent but the email; the address, phone and cart lines stay in Medusa.

Licence

MIT. Source: https://github.com/orboni/medusa-plugin-orboni

You may also like

Browse all integrations

Build your own

Develop your own custom integration

Build your own integration with our API to speed up your processes. Make your integration available via npm for it to be shared in our Library with the broader Medusa community.

gift card interface

Ready to build your custom commerce setup?