@pabgw/vue

PAB Gateway Payment Form — Vue 3 component
109
Install
npm install @pabgw/vue
Latest Version:1.1.0
Vue:3
License:MIT
Last Updated:Oct 12, 2026
Links: Repository  ·  npm
Maintainer: alespin2021

@pabgw/vue

Vue 3 component and composable for embedding PAB Gateway payment forms into your application.

Installation

npm install @pabgw/vue

Requirements

  • Vue 3.0+

Quick Start

<template>
  <PabPayment
    :session="sessionToken"
    @success="onSuccess"
    @error="onError"
    @expired="onExpired"
  />
</template>

<script setup>
import { PabPayment } from '@pabgw/vue';

const props = defineProps({ sessionToken: String });

function onSuccess(data) {
  console.log('Payment successful', data.transactionId);
}

function onError(data) {
  console.error('Payment failed', data.message);
}

function onExpired() {
  console.warn('Session expired');
}
</script>

Usage Modes

The component supports two modes:

Use a pre-generated payment link token:

<PabPayment token="pl_abc123" @success="onSuccess" />

Checkout API (session)

Create a Checkout Session from your backend and pass the resulting session identifier to the session prop.

<PabPayment :session="sessionSecret" @success="onSuccess" />

Use token OR session, not both.

Create a session (api/v2/sessions)
POST https://gateway.pabgw.com/api/v2/sessions
x-api-key: <partner-api-key>
x-merchant-key: <merchant-key>
Content-Type: application/json

{
  "mode": "payment",        // or "setup"
  "amount": 100.00,
  "reference": "INV-001",
  "payerEmail": "buyer@example.com"
}

Response (201 Created):

{
  "result": {
    "sessionId": "…",
    "sessionToken": "Xk3r…",
    "checkoutUrl": "https://quick2pay.pabgw.com/s/Xk3r…",
    "expiresAt": "…",
    "status": 0
  },
  "success": true,
  "statusCode": 201,
  "errors": []
}

The session lives under result; errors arrive as errors: [{ "code", "message" }]. status is numeric (0 = pending).

Pass result.sessionToken to the session prop:

<PabPayment :session="response.result.sessionToken" />
Setup mode (save a payment method without charging)

Omit amount and set mode: "setup". Supply payorCompanyId to attach the saved method to an existing customer.

{ "mode": "setup", "payorCompanyId": "<customer-guid>" }

Component Props

Prop Type Default Description
token string — Payment link token
session string — Checkout API session token
method string — Pre-select payment method: 'cc' or 'ach'
environment 'production' | 'sandbox' 'production' Loads the SDK and the payment form from the production or the sandbox hosts. Use 'sandbox' with a sandbox session or payment link

Events

Event Payload Description
ready any Payment form has loaded and is ready
success { transactionId, amount, authCode, feeAmount?, totalCharged?, lastDigits? } Payment completed successfully
error { code, message } Payment failed. code is not a fixed, enumerated list — branch on message for display.
processing — Payment is being processed
feesCalculated { amount, feeAmount, totalAmount } Fees have been calculated
expired — Session has expired (Checkout API only)

Composable (Programmatic)

For more control, use the usePabPayment composable:

<template>
  <div ref="containerRef" />
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { usePabPayment } from '@pabgw/vue';

const containerRef = ref(null);
const { mount, destroy } = usePabPayment();

onMounted(async () => {
  const pab = await mount({
    session: 'YOUR_SESSION_TOKEN',
    container: containerRef.value,
  });

  pab.on('success', (data) => console.log('Paid!', data));
  pab.mount();
});
</script>

Content Security Policy (CSP)

If your site uses a Content Security Policy header, add the directives for whichever environment you use:

# production (default)
frame-src https://pay.pabgw.com; script-src https://cdn.pabgw.com;

# sandbox
frame-src https://pay.dev-pabgw.com; script-src https://cdn.dev-pabgw.com;

With environment="sandbox" the component loads from the sandbox hosts instead, so add them while testing:

frame-src https://pay.dev-pabgw.com; script-src https://cdn.dev-pabgw.com;

Changelog

1.1.0

  • PabPayment is now part of the package (1.0.0 shipped without it, so importing the package failed).
  • Loads the SDK from cdn.pabgw.com.
  • New environment prop (production / sandbox).

License

MIT

Related Packages

@cardknox/vue-cardknox-ifields

A Vue component for Cardknox iFields

22,667 2
payplus-ipg

PayPlus Payment Gateway SDK for JavaScript/TypeScript — works with React, Next.j...

1,279
vue-payjp-checkout

PAY.JP Checkout component for Vue.js

1,177 14
@rebilly/framepay-vue

Official Vue wrapper for Rebilly FramePay

78,075
paymid-sdk

A frontend SDK for Paymid payment processing

15,682

Version History

Version Released Vue License
1.1.0 >=3.0.0 MIT
1.0.0 >=3.0.0 MIT