3.0 KiB
3.0 KiB
@suaveplan/payment-provider-mollie - Universal Mollie Payments API v2 adapter for @suaveplan/payment. Sibling provider package on the slim @suaveplan/payment-providers core: implements PaymentProvider with Mollie's string-amount marshalling ({ currency, value: "X.YY" }) round-trip via exported formatMollieAmount / parseMollieAmount helpers.
Universal Mollie Payments API v2 adapter for @suaveplan/payment.
Sibling provider package on the slim @suaveplan/payment-providers
core: implements PaymentProvider with Mollie's string-amount
marshalling ({ currency, value: "X.YY" }) round-trip via the
exported formatMollieAmount / parseMollieAmount helpers.
Documentation tree
- mollie —
MollieProvideris the sibling adapter that implements thePaymentProvidercontract from `@suaveplan/payment…- mollie —
MollieProvideris the sibling adapter that implements thePaymentProvidercontract from `@suaveplan/payment…
- mollie —
Install
bun add @suaveplan/payment-provider-mollie @suaveplan/payment-providers @suaveplan/payment
Quick start
import { ProviderRegistry } from "@suaveplan/payment-providers";
import { MollieProvider } from "@suaveplan/payment-provider-mollie";
const registry = new ProviderRegistry();
registry.register(
new MollieProvider({ apiKey: process.env.MOLLIE_API_KEY ?? "" })
);
const mollie = registry.get("mollie");
const intent = await mollie.createIntent({
amount: { amount: 5000n, currency: "EUR" },
description: "Order #42",
returnUrl: "https://shop.example/return",
});
console.log(intent.id, intent.status);
Features
MollieProvider— fullPaymentProviderlifecycle (createIntent,confirmIntent,captureIntent,cancelIntent,refund,getIntent) on top of the slimhttpRequesthelper.- Pure, exported amount helpers —
formatMollieAmount(amount: bigint)andparseMollieAmount(value: string)— that round-trip losslessly viabigintand cover the 1-cent, exact-major, large-value, and over-precision edges. - Total exported status maps —
mapMollieStatusandmapMollieRefundStatus— each individually unit-testable without invoking the network path. Authorization: Bearer <apiKey>header auto-applied on every call.- Universal — no Node-specific or browser-specific globals; runs on Node 18+, Bun, browsers, and Web Workers.
- All failures surface as
PaymentProviderErrorfrom@suaveplan/payment-providerscarrying aPAYMENT_PROVIDER_*code.
Modules
src/mollie/mollie.md—MollieProviderclass, helpers, and status maps.
Sibling packages
Part of the @suaveplan/payment-provider-* family. See
@suaveplan/payment-providers for the
shared foundation (ProviderRegistry, httpRequest,
composeAbortSignal, PaymentProviderError, the PAYMENT_PROVIDER_*
code registry, and the shared config shapes).