Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.usepaykit.dev/llms.txt

Use this file to discover all available pages before exploring further.

npm install @paykit-sdk/comgate

Setup

import { PayKit } from '@paykit-sdk/core';
import { comgate } from '@paykit-sdk/comgate';

export const paykit = new PayKit(comgate());
Required env vars:
COMGATE_MERCHANT=your-merchant-id
COMGATE_SECRET=your-secret
COMGATE_SANDBOX=true

Webhooks

const webhook = paykit.webhooks
  .setup({ webhookSecret: process.env.COMGATE_WEBHOOK_SECRET! })
  .on('payment.created', async event => { /* ... */ })
  .on('payment.updated', async event => { /* ... */ });

await webhook.handle({
  body: rawBody,
  headersAsObject: Object.fromEntries(request.headers),
  fullUrl: request.url,
});

Raw Comgate events

paykit.webhooks
  .setup({ webhookSecret: process.env.COMGATE_WEBHOOK_SECRET! })
  .on('comgate.payment_paid', async event => {
    // typed against Comgate's API types
  });