SDK Installation

Full setup guide for the Flintn Payment Checkout SDK (flintn-checkout).

Installation

npm install flintn-checkout

Quick Start

Vanilla JavaScript

import { FlintNPayment } from 'flintn-checkout';

const payment = new FlintNPayment({
  config: {
    clientSessionId: 'your_client_session_id',
  },
  onReady: () => {
    document.getElementById('loading').style.display = 'none';
  },
  onPayment: (result) => {
    if (result.status === 'PAYMENT_SUCCESS') {
      console.log('Payment succeeded:', result.data);
    } else {
      console.log('Payment failed:', result.error);
    }
  },
  onExpressPayment: (result) => {
    console.log('Express payment:', result);
  },
  onError: (err) => {
    console.error('SDK error:', err.message);
  },
});

payment.mount('#payment-container');

// When done (e.g., page navigation)
payment.unmount();

React

Configuration

Option
Type
Required
Default
Description

clientSessionId

string

Client session ID from your backend

isCardHolderRequired

boolean

true

Require cardholder name field

successRedirectUrl

string

Redirect URL after successful payment

Note: isCardHolderRequired only applies when using Primer as the payment provider.

Callbacks

Callback
Description

onPayment

Fired when card payment completes (success or error)

onExpressPayment

Fired when express payment completes (Apple Pay, Google Pay, PayPal)

onReady

Fired when widget is loaded and ready

onError

Fired on SDK initialization error

React Hook

Options

The useFlintNPayment hook accepts the same config and callbacks as the vanilla SDK. onReady and onError are managed internally — use the returned isReady and error values instead.

Return Values

Value
Type
Description

containerRef

RefObject<HTMLDivElement>

Ref to attach to container element

isReady

boolean

Widget is loaded and ready

paymentResult

PaymentResult | null

Result after payment attempt

error

PaymentError | null

SDK error if any

Types

PaymentResult

PaymentError

SDK Options

Option
Type
Required
Description

config

FlintNConfig

Checkout configuration (see Configuration above)

origin

string

Override checkout URL (default: https://pay.flintn.com)

onPayment

function

Card payment callback

onExpressPayment

function

Express payment callback

onReady

function

Widget ready callback

onError

function

Error callback

debug

boolean

Enable console debug logs

Vanilla JavaScript API

mount(selector)

Mount the checkout widget to a DOM element.

unmount()

Remove the widget and clean up event listeners.

getIsReady()

Check if the widget is loaded and ready.

Debug Mode

Enable debug logs to see SDK activity in the console:

Supported Payment Methods

  • 💳 Credit/Debit Cards (Visa, Mastercard, Amex, Discover)

  • 🍎 Apple Pay

  • 🔵 Google Pay

  • 🟡 PayPal

Test Cards

Card Number
Result

4111 1111 1111 1111

Success

4000 0000 0000 0002

Declined

Use any future expiry date and any 3-digit CVV.

Browser Support

  • Chrome (latest)

  • Firefox (latest)

  • Safari (latest)

  • Edge (latest)

Next Steps

For direct iframe integration without the SDK, see Manual Installation.

Last updated