Skip to content

The Cryptonly plugin for Vendure lets your Vendure store accept cryptocurrency payments through Cryptonly’s hosted checkout.

Customers choose Cryptonly at checkout, pay on the Cryptonly payment page and return to your store. The order is placed once Cryptonly confirms the payment through a signed webhook. There is no manual reconciliation.

Setup takes four steps:

  1. Install the plugin
  2. Create a Cryptonly payment method in the Dashboard
  3. Redirect to the payment page from your storefront
  4. Add a return page that waits for the payment

In detail:

  1. The customer reaches ArrangingPayment, and the storefront calls the standard addPaymentToOrder mutation with the Cryptonly method.
  2. Vendure creates a Cryptonly invoice server-side, so your API key never reaches the browser. It records a payment in the Created state. The cart is locked while the invoice is open.
  3. The storefront redirects the customer to the hosted payment page (paymentPageUrl).
  4. Cryptonly sends signed webhooks to Vendure. The plugin verifies each one, confirms the invoice status with the Cryptonly API, and settles the payment once the invoice is paid or overpaid.

For details on invoices and statuses, see Invoices.

RequirementDetails
Vendure3.8+
Node22.12+
Cryptonly accountmerchant.cryptonly.net
Public HTTPS serverCryptonly must reach {host}/payments/cryptonly/{channelToken}/{paymentMethodId}

Install the plugin:

Terminal window
npm install @cryptonly/vendure-plugin-cryptonly

Add it to vendure-config.ts:

import { DefaultEncryptionStrategy, VendureConfig } from '@vendure/core';
import { CryptonlyPlugin } from '@cryptonly/vendure-plugin-cryptonly';
export const config: VendureConfig = {
// ...
systemOptions: {
// Needed only with encryptSecrets: true
encryptionStrategy: new DefaultEncryptionStrategy({ secret: process.env.VENDURE_ENCRYPTION_KEY }),
},
plugins: [
CryptonlyPlugin.init({
host: process.env.VENDURE_PUBLIC_URL, // e.g. https://api.my-shop.com
encryptSecrets: true,
}),
],
};
OptionRequiredDescription
hostYesPublic HTTPS origin of the Vendure server. Webhooks are sent to {host}/payments/cryptonly/.... Localhost and IP addresses are rejected.
encryptSecretsNoStore the API key and signing key encrypted, and hide them from admins without the ReadSecret permission. Requires an EncryptionStrategy with a key. Default: false.

The plugin adds no database columns, so no migration is needed.

In the Dashboard, open Settings → Payment methods, create a payment method with the code cryptonly and choose the Cryptonly crypto payments handler:

Vendure Dashboard payment method Crypto (Cryptonly) with the Cryptonly crypto payments handler: masked API key and webhook signing key, Sandbox mode, invoice lifetime and the return URL.Vendure Dashboard payment method Crypto (Cryptonly) with the Cryptonly crypto payments handler: masked API key and webhook signing key, Sandbox mode, invoice lifetime and the return URL.
FieldDescription
API keyAPI key from the account Security settings. The key selects the account.
Webhook signing keySigning key from the same account. Used to verify webhooks.
Sandbox modeTurn on for sandbox keys.
Invoice lifetime (minutes)Optional, 15 to 43200. Empty uses the account default.
Return URLYour storefront’s return page, opened by the Return to button on the hosted page whatever the outcome. {orderCode} is replaced with the order code.

Create one payment method per channel that should accept crypto. Each channel can use its own Cryptonly account.

ScopeUsed for
invoices.createCreate the invoice when the customer places the order
invoices.listConfirm the invoice status for webhooks and manual settlement
invoices.cancelCancel the invoice when the customer leaves checkout

The plugin sets the webhook URL on every invoice, so you do not need to configure a default webhook in the Merchant Dashboard.

The order must be in ArrangingPayment. Add the payment and send the customer to its paymentPageUrl:

const { addPaymentToOrder } = await shopApi(`
mutation {
addPaymentToOrder(input: { method: "cryptonly", metadata: {} }) {
__typename
... on Order { code payments { method state metadata } }
... on ErrorResult { errorCode message }
... on PaymentFailedError { paymentErrorMessage }
}
}
`);
const payment = addPaymentToOrder.payments.find(
(p) => p.method === 'cryptonly' && p.state === 'Created'
);
window.location.assign(payment.metadata.public.paymentPageUrl);

If the customer places the order again while the invoice is still open, redirect to the same paymentPageUrl from activeOrder.payments. A second addPaymentToOrder returns PaymentFailedError until the order goes back to AddingItems.

Set the payment method’s Return URL to a page such as /checkout/cryptonly/{orderCode}. Customers land there whether they paid, cancelled or let the invoice expire, so the page polls the Shop API every few seconds:

What you seeMeaning
activeOrder has this code, state ArrangingPaymentWaiting for payment: show a spinner
activeOrder has this code, state AddingItemsInvoice cancelled or expired: send back to checkout
orderByCode(code) returns PaymentSettledPaid: show the order confirmation
Storefront return page: Waiting for payment confirmation, with a Back to the payment page button.Storefront return page: Waiting for payment confirmation, with a Back to the payment page button.

Ready-made helpers for both steps are in the plugin’s assets/storefront folder.

Cryptonly statusVendure
paid, overpaidPayment Settled, order moves to PaymentSettled
created, processingPayment stays Created
cancelled, expired, failedPayment Declined, order goes back to AddingItems
partially_paid, suspendedPayment stays Created and is flagged needsReview. Resolve it in the Merchant Dashboard
Vendure Dashboard order in Payment settled state with a settled cryptonly payment of $27.79 and the Cryptonly invoice ID as transaction ID.Vendure Dashboard order in Payment settled state with a settled cryptonly payment of $27.79 and the Cryptonly invoice ID as transaction ID.

Keep in mind:

  • When an order leaves ArrangingPayment unpaid (the customer returns to the cart, or the order is cancelled), the open invoice is cancelled in Cryptonly.
  • Settle in the Dashboard only succeeds when Cryptonly reports the invoice as paid. Cancel is refused once the invoice has received funds.
  • Refunds made in Vendure are not sent to Cryptonly. Refund the customer from the Merchant Dashboard.

For webhook signing details, see Webhooks. For sandbox testing, see Testing your integration.

For help with your Cryptonly merchant account, credentials, or payment questions, write to support@cryptonly.net.