Subscription Payments

Accept your first subscription payment in 6 steps.

Overview

This guide walks you through:

  1. Creating an API key

  2. Configuring a webhook endpoint

  3. Creating a subscription plan

  4. Generating a client session

  5. Initializing the payment iframe

  6. Verifying the subscription

Prerequisites

Step 1: Create an API Key

Create an API key with the permissions needed for subscription payments.

  1. Navigate to Developers > API Keys

  2. Click Create API Key

  3. Enter a name (e.g., "Subscription Integration")

  4. Select these permissions:

    • subscription.client_session.create

    • subscription.read

    • subscription_plan.read

    • subscription_plan.write

  5. Click Create

  6. Copy and securely store your API key - it won't be shown again

Your key will look like: pk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

For more details, see Authentication.

Step 2: Configure Webhook Endpoint

Set up a webhook to receive subscription events.

Create Your Endpoint

Your server needs an HTTPS endpoint to receive webhook notifications:

Register the Webhook

  1. Navigate to Developers > Webhooks

  2. Click Add Webhook

  3. Enter your HTTPS endpoint URL

  4. Select these events:

    • SUBSCRIPTION_ACTIVATED

    • SUBSCRIPTION_RENEWED

    • SUBSCRIPTION_CANCELLED

    • SUBSCRIPTION_EXPIRED

    • TRANSACTION_SETTLED

  5. Click Create

  6. Copy your webhook secret for signature verification

For more details, see Configure Webhooks.

Step 3: Create a Subscription Plan

Create a plan that defines your subscription's pricing and billing terms.

Response:

Save the id for the next step.

For more options, see Create Plans via API.

Step 4: Create a Client Session

Generate a secure client session token to initialize the payment iframe.

Response:

The client_session_token is used to initialize the payment iframe. Tokens expire after 24 hours.

Step 5: Initialize the Payment Iframe

Embed the Flintn payment iframe in your checkout page and communicate with it via postMessage.

Add the Iframe

Configuration Options

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.

For more details, see Checkout Reference.

Step 6: Verify the Subscription

After the customer completes payment, verify the subscription was created.

Via Webhook

Your webhook endpoint will receive a SUBSCRIPTION_ACTIVATED event:

Via API

Query the subscription directly:

Response:

View Transactions

Verify the payment transaction:

Test Cards

Use these test card numbers in the sandbox environment:

Card Number
Result

4111 1111 1111 1111

Successful payment

4000 0000 0000 0002

Declined

4000 0000 0000 9995

Insufficient funds

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

See Testing for more test scenarios.

Next Steps

You've successfully set up subscription payments. Continue with:

Production Checklist

Before going live:

Last updated