API reference

Vendure

The Orboni plugin adds crypto to a Vendure 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 the order is paid once the payment is final — by the webhook or the buyer’s return, whichever comes first.

It is a payment plugin for Vendure 3, tested end to end on Vendure 3.8. It is free, and its source is open, under the MIT licence: orboni/vendure-plugin-orboni on GitHub, @orboni/vendure-plugin on npm.

Set it up

npm install @orboni/vendure-plugin

In vendure-config.ts, add it to the plugins, then restart the server:

import { OrboniPlugin } from '@orboni/vendure-plugin';

export const config: VendureConfig = {
  // …
  plugins: [
    // …
    OrboniPlugin.init(),
  ],
};
  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.
  2. 2In the Vendure dashboard, open Settings → Payment methods, create one with the Orboni handler (say, “Crypto (USDT, USDC, BTC and more)”, code crypto), enter the Secret key, and the Return address of your storefront’s page for a paid order (below). Assign it to your channel.
  3. 3In the Orboni dashboard, under Developers → Webhooks, add an endpoint at https://<your Vendure server>/payments/orboni/<channel token> (the token is under Settings → Channels) with the checkout.session.* events, and enter its signing secret (whsec_…) as the payment method’s Webhook signing secret.
  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 paid. 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 asks the Shop API for the order’s payment page, sends the buyer there, and records the payment when they come back. With a Return address such as https://shop.example.com/order/{ORDER_CODE}?session={CHECKOUT_SESSION_ID} the page knows both:

# The payment step: the order has its customer, address and shipping.
mutation {
  createOrboniPaymentIntent(input: { paymentMethodCode: "crypto" }) {
    url        # send the buyer here
    sessionId
  }
}

# Back from the payment page (the Return address carries the session):
mutation {
  addPaymentToOrder(input: { method: "crypto", metadata: { sessionId: "cs_…" } }) {
    ... on Order { code state }        # PaymentSettled, or PaymentAuthorized
    ... on ErrorResult { errorCode message }
  }
}

createOrboniPaymentIntent moves the active order to ArrangingPayment and takes successUrl and cancelUrl too, over the payment method’s. Paying again opens the same page while the order’s total stays the same. When the buyer is back before the money is final, addPaymentToOrder answers with an error that says why (not paid yet, part paid): show it, and let the buyer pay or choose another way. When the webhook was first, the order is no longer active: read it with orderByCode.

How orders move

The plugin reads the payment back from Orboni with your key before Vendure records it, so a webhook sent twice, late or out of order changes nothing, and a storefront cannot record a payment that is not there. Without the webhook a payment is still recorded once the buyer comes back; a buyer who pays and closes the tab needs it, so set it up all the same.

PaymentOrboni saysIn Vendure
Paid in fullcomplete, paidA Settled payment naming the coin, the order PaymentSettled — by the webhook or the buyer’s return, whichever comes first
On the chain, not final yet; or held for your reviewprocessing, heldAn Authorized payment, the order PaymentAuthorized; settled by the webhook once paid
Part paidpartially_paidNothing recorded; the payment page asks the buyer for the rest
Back before payingopen, unpaidNothing recorded, the buyer told so; paying again opens the same page
Ran out unpaidexpiredNothing recorded
Money that paid it left the chainpayment_reversedA private note on the order not to ship it until the dashboard shows it paid again

An order taken back to AddingItems and changed gets a new page for its new total, and the old one is closed, so it can no longer be paid.

The payment method’s settings

Secret keystring
Required. sk_test_… or sk_live_…; the key decides test or live.
Webhook signing secretstring
The endpoint’s whsec_…. Without it the webhook is answered 503 and nothing is read.
Return addressstring
Your storefront’s page the buyer comes back to; {ORDER_CODE} is filled in by the plugin, {CHECKOUT_SESSION_ID} by Orboni.
Back addressstring
Where the payment page’s back link goes; {ORDER_CODE} is filled in.

Good to know

  • The currency: the order’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, the intent fails with a reason, and the buyer chooses another way.
  • The least is worth $1.00. Below it the intent fails with Orboni’s reason.
  • Refunds: the money is in your wallet, so send it back from there, then refund the payment in Vendure: it is recorded in Orboni, and nothing moves by itself.
  • Several channels, or several Vendure servers, can share one Orboni project: each channel adds its own endpoint, with its token in the address, and acts only on its own orders.
  • Errors from Orboni reach the storefront with Orboni’s own message, as “Orboni: …”, and Vendure’s log under OrboniPlugin; keys and secrets never do.

What the plugin sends

Each intent makes a checkout session through POST /v1/checkout/sessions, with an idempotency key of the channel, the order and its total, so a double press never makes a second one.

amountinteger
What is left to pay of the order, in the currency’s smallest unit: cents, or whole yen.
currencystring
The order’s currency, in lower case: usd, eur, jpy…
descriptionstring
The order’s lines with their quantities: “Blue mug × 2”; cut at 250 characters.
detailsstring
The order code: “Order PTZ6JXBG23H3GXRD”.
client_reference_idstring
The order code, which the webhook finds the order by.
metadataobject
vendure_order_code, vendure_order_id, vendure_channel (the channel’s token) and vendure_payment_method (the method’s code).
customer_emailstring
The order’s customer’s email, where Orboni sends the receipt when your project sends receipts.
localestring
The request’s language, as en.
success_url, cancel_urlstring
The storefront’s, or the payment method’s Return and Back addresses.

No address, phone number or other buyer data is sent. A payment in the dashboard, an export or a webhook leads to its order by client_reference_id, and an order to its payment by the session id, the payment’s transaction id in Vendure.

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