Loading...
Loading...
Implement CEP-8 payments in ContextVM using the @contextvm/sdk payments middleware. Use when building paid servers/clients, configuring priced capabilities, integrating payment processors/handlers, or troubleshooting payment notification flows.
npx skill4agent add contextvm/cvmi payments../typescript-sdk/SKILL.md../server-dev/SKILL.md../client-dev/SKILL.mdimport type { PricedCapability } from '@contextvm/sdk/payments';
import {
LnBolt11NwcPaymentProcessor,
withServerPayments,
} from '@contextvm/sdk/payments';
const pricedCapabilities: PricedCapability[] = [
{
method: 'tools/call',
name: 'my-tool',
amount: 10,
currencyUnit: 'sats',
description: 'Example paid tool',
},
];
const processor = new LnBolt11NwcPaymentProcessor({
nwcConnectionString: process.env.NWC_SERVER_CONNECTION!,
});
const paidTransport = withServerPayments(baseTransport, {
processors: [processor],
pricedCapabilities,
});import {
LnBolt11NwcPaymentHandler,
withClientPayments,
} from '@contextvm/sdk/payments';
const handler = new LnBolt11NwcPaymentHandler({
nwcConnectionString: process.env.NWC_CLIENT_CONNECTION!,
});
const paidTransport = withClientPayments(baseTransport, {
handlers: [handler],
});notifications/payment_requirednotifications/payment_acceptednotifications/payment_rejectedebitcoin-lightning-bolt11pricedCapabilities[].amountcurrencyUnitresolvePricepricedCapabilitiesresolvePriceresolvePrice → { reject: true, message? }references/server-setup.mdpayment_rejectedpmiwithClientPaymentsreferences/client-setup.mdbitcoin-lightning-bolt11LnBolt11NwcPaymentProcessorLnBolt11NwcPaymentHandlerreferences/lightning-nwc.mdLnBolt11LnbitsPaymentProcessorLnBolt11LnbitsPaymentHandlerreferences/lightning-lnbits.mdPaymentProcessorPaymentHandlerreferences/custom-rails.mdpayment_requiredmethodnamepricedCapabilitiespayment_acceptednotifications/payment_rejectedmessage../troubleshooting/SKILL.mdreferences/cep-8-overview.mdreferences/server-setup.mdreferences/client-setup.mdreferences/lightning-nwc.mdreferences/lightning-lnbits.mdreferences/custom-rails.md