Skip to content

API surface ​

All public APIs are typed TypeScript exports. Browser and chain helpers stay explicit — pass addresses and viem clients on each call. SDK settings are bound once via initialize, not globals.

Entry points ​

ImportRuntimeContents
@0xcurvy/payments-sdkBrowser and NodeRe-exports browser-safe helpers
@0xcurvy/payments-sdk/intentBrowser and NodeRequest parse / sign / verify
@0xcurvy/payments-sdk/transportBrowser and NodeFragment and URL helpers
@0xcurvy/payments-sdk/chainBrowser and NodeChain reads and watches
@0xcurvy/payments-sdk/contractsBrowser and NodeABIs
@0xcurvy/payments-sdk/merchant/keysBrowser and NodeWell-known signer document
@0xcurvy/payments-sdk/merchantNode onlyinitialize, createPaymentRequest

Merchant ​

ts
import { initialize, createPaymentRequest } from "@0xcurvy/payments-sdk/merchant";
ExportRole
initializeBind recipient, chainId, merchantOrigin, confirmations, and TTL; returns { createPaymentRequest, verifyPayment }
createPaymentRequestStandalone derive note + unsigned request with full parameters (Node)
buildPaymentRequestDerive an unsigned request from fully specified parameters (Node)

initialize config fields:

FieldRequiredDefaultDescription
recipientyes—Your public receiving keys (S, V, babyJubjubPublicKey). The SDK uses them to derive a fresh one-time payment destination for each request. Use only public material — keep spending and viewing keys offline.
chainIdyes—EVM network where customers pay and where you call verifyPayment. Must match the chain your accepted token and Curvy contracts are deployed on.
merchantOriginyes—Your shop’s bare HTTPS origin (https://shop.example) — scheme and host only, no path, query, or fragment. Signed into every payment request; Curvy uses it as the base for the post-checkout return URL.
confirmationsyes—Block confirmations required before bound verifyPayment returns true when you pass a txHash (e.g. 12 on Ethereum mainnet).
ttlSecondsno600How long each payment request stays valid, in seconds. Sets expiry on the signed request; after that timestamp checkout rejects the request.
checkoutCompletePathno/checkout/completeAbsolute path on merchantOrigin where Curvy sends the customer after a successful shield: {merchantOrigin}{path}#txHash=…. Always included in the EIP-712 payload (default path is used when omitted).

Bound createPaymentRequest requires only amount and token. Bound verifyPayment uses the confirmations value from init — pass publicClient, aggregatorAddress, ephemeralKey, and optionally txHash / fromBlock.

Request signing (/intent) ​

EIP-712 export names retain PaymentIntent for wire compatibility.

ts
import {
  buildPaymentIntentTypedData,
  parsePaymentIntent,
  parseSignedPaymentIntent,
  paymentIntentTypes,
  signPaymentIntent,
  verifyPaymentIntent,
} from "@0xcurvy/payments-sdk/intent";
ExportRole
signPaymentIntentAttach EIP-712 signature via your signer adapter
verifyPaymentIntentRecover signer address; check well-known set, expiry, chain, token
parsePaymentIntent / parseSignedPaymentIntentCanonicalize untrusted input
buildPaymentIntentTypedData / paymentIntentTypesEIP-712 payload

Unknown fields such as paymentId or recovery are rejected. Omitted checkoutCompletePath becomes /checkout/complete (DEFAULT_CHECKOUT_COMPLETE_PATH).

Transport ​

ts
import {
  buildCheckoutCompleteUrl,
  buildCheckoutUrl,
  decodePaymentIntentFragment,
  encodePaymentIntentFragment,
} from "@0xcurvy/payments-sdk/transport";
ExportRole
buildCheckoutUrlPut signed package in checkout URL fragment
encodePaymentIntentFragment / decodePaymentIntentFragmentBase64url fragment codec
buildCheckoutCompleteUrl{merchantOrigin}{path}#txHash=…

Chain ​

ts
import {
  findNoteInReceipt,
  predictPortalAddress,
  verifyPayment,
} from "@0xcurvy/payments-sdk/chain";
ExportRole
predictPortalAddressPortalFactory.getEntryPortalAddress
verifyPaymentReturns true when the payment reference is confirmed or batch-settled. Throws on reverted or invalid shield transactions. Standalone /chain export requires confirmations; bound sdk.verifyPayment uses the init value.
findNoteInReceiptMatch payment reference in aggregator logs on a receipt you already have

Merchant keys ​

ts
import { buildMerchantKeySet, parseMerchantKeySet } from "@0xcurvy/payments-sdk/merchant/keys";

Produces and validates the /.well-known/curvy-payments.json document (version: 1, alg: eip712-secp256k1).

Contracts ​

ts
import {
  aggregatorAbi,
  pendingNotesAbi,
  portalFactoryAbi,
  vaultAbi,
} from "@0xcurvy/payments-sdk/contracts";

Constants ​

ts
import { DEFAULT_CHECKOUT_COMPLETE_PATH, DEFAULT_PAYMENT_REQUEST_TTL_SECONDS } from "@0xcurvy/payments-sdk";
// "/checkout/complete"
// 600
PackageRole
@0xcurvy/rs-core-wasmPeer for /merchant note derivation
@0xcurvy/x402-protocolx402 wire types (not part of this package)
@0xcurvy/curvy-sdkWallet SDK — do not use for shop checkout

For the agent x402 exact rail (shopper vs payments-sdk merchant), see x402 and the Payments SDK.