Skip to content

commercetools-buckaroo

@evolve-framework/commercetools-buckaroo · v1.0.0

Buckaroo payments for the commercetools engine: a payment adapter that lists Buckaroo's payment methods, starts payments, and processes the shopper's return and Buckaroo's webhooks, recording each on the commercetools payment.

When to use

Use it when Buckaroo is a payment provider of a shop on @evolve-framework/commercetools. There is one package per provider, and a shop can register several. It only works behind the commercetools engine.

The adapter runs in one of two ways: as a payment service of its own, with PaymentProviderModule mounting its routes, as in the example below; or inside the commercetools service, registered in the PaymentRegistry that the cart, checkout and payment modules are given.

  • Payment methods: iDEAL and Mastercard. The list is fixed in this adapter rather than read from the Buckaroo account.
  • Webhook route: POST /push, Buckaroo's push. The shopper returns to POST /redirect. Inside the commercetools service, registered in a PaymentRegistry, the routes are prefixed with /buckaroo, for example /buckaroo/push.

Get started

  1. Install the package with the peer dependencies it needs. It comes from the Evolve registry, which needs a one-time sign-in.

    pnpm add @evolve-framework/commercetools-buckaroo @evolve-framework/commercetools @evolve-framework/core fastify zod
    Requirements6
    @evolve-framework/commercetools>= 0.10.0 < 2.0.0
    @evolve-framework/core>= 1.0.0 < 2.0.0
    @types/node>=22optional
    fastify>= 5.12.1 < 6.0.0
    msw^2.14.6 || ^3.0.1optional
    zod>= 4.4.0 < 5.0.0

For example:

import {
ClientFactory,
type CommercetoolsLoaderContext,
PaymentProviderModule,
} from "@evolve-framework/commercetools";
import { BuckarooPaymentAdapter } from "@evolve-framework/commercetools-buckaroo";
import {
CompositeModule,
createApplication,
HealthModule,
} from "@evolve-framework/core";
const clientFactory = ClientFactory.create({
projectKey: process.env.CTP_PROJECT_KEY!,
apiUrl: process.env.CTP_API_URL!,
authUrl: process.env.CTP_AUTH_URL!,
clientId: process.env.CTP_CLIENT_ID!,
clientSecret: process.env.CTP_CLIENT_SECRET!,
scopes: process.env.CTP_SCOPES?.split(",") ?? [],
});
const app = await createApplication({
name: "payment-commercetools-buckaroo",
module: new CompositeModule<CommercetoolsLoaderContext>([
new PaymentProviderModule({
adapter: new BuckarooPaymentAdapter({
clientFactory,
config: {
credentials: {
secretKey: process.env.BUCKAROO_SECRET_KEY!,
websiteKey: process.env.BUCKAROO_WEBSITE_KEY!,
},
mode: (process.env.BUCKAROO_MODE ?? "TEST") as "TEST" | "LIVE",
currency: process.env.BUCKAROO_CURRENCY ?? "EUR",
serverUrl: process.env.SERVER_URL!,
},
}),
internalRoutes: true,
externalRoutes: true,
}),
// Serves /healthcheck for the liveness probe and /readiness for the
// dependency check. `graphql: false` because this service has no schema.
new HealthModule({ name: "commercetools-buckaroo", graphql: false }),
]),
http: {
address: {
host: process.env.HTTP_HOST ?? "localhost",
port: Number(process.env.HTTP_PORT ?? 4022),
},
},
});
await app.start();

Adapters

BuckarooPaymentAdapter

Buckaroo as a commercetools payment provider, offering iDEAL and Mastercard.

import { BuckarooPaymentAdapter } from "@evolve-framework/commercetools-buckaroo";
new BuckarooPaymentAdapter(options: BuckarooPaymentAdapterOptions)
OptionTypeDescription
clientFactoryClientFactory

Pre-configured commercetools ClientFactory, used to build a system request builder for commercetools reads/writes.

configBuckarooConfig

Buckaroo credentials and runtime settings used by the SDK and routes.

BuckarooConfig4The fields of config.
FieldTypeDescription
credentials{ secretKey: string; websiteKey: string; }
modeBuckarooMode
currencystring
serverUrlstring

Extends BasePaymentAdapter.

Entry points

@evolve-framework/commercetools-buckarooBuckarooPaymentAdapter and its options, configuration and client.7 exports
@evolve-framework/commercetools-buckaroo/testingAn MSW server with the mocked commercetools project, for testing a service that uses the adapter.1 export