Skip to main content
This guide explains how to integrate the Paybyrd Card Collect widget.

Overview

Card Collect is a JavaScript plugin that lets you process credit card payments without handling card data directly, so your integration does not require PCI compliance. The widget provides secure, customizable fields where the cardholder enters their card details. The widget converts those details into a temporary token you can use with any Paybyrd API that requires card data.

Installation

Install the package:
Then import the module into your project:
For usage in the browser, visit the Card Collect GitHub repository, download dist/cardCollect-web.js, and include it in your HTML file.

Quick Start

Designate the HTML elements where your fields will render, then initialize the library.
You can pass the following options when initializing the library: Finally, you can create fields and configure the submit handler.
You should have at least one field with the name card_number and one with card_exp. These are mandatory. The response is a JSON object that will contain the TokenId. These tokens are different from tokenization API tokens. Card Collect tokens are short-lived and are discarded after use.
With the TokenId, you can call any Paybyrd API that requires card data. Inside the Card node, instead of sending the raw card data, you will send the TokenId as shown in the sample below:

Adding fields

Mandatory fields

You must include at minimum:
  • card_number (type: 'card-number')
  • card_exp (type: 'card-expiration-date')

Field properties

Supported validations

Each validation rule produces a specific error message when it fails:

Styling

The container element receives one of these classes depending on field state:
  • & .invalid — the field has an invalid value
  • & .valid — the field has a valid value
  • & .empty — the field has no value
  • & .dirty — the user has changed the field’s value
  • & .touched — the field has been focused and blurred at least once
Media queries in css are calculated against the iframe’s width, not the parent window’s.

Submitting

Response

Using the token in a payment

Pass tokenId in place of raw card fields:

Supported card brands

Advanced: Smart CVC

Link the CVC field to the card number field for brand-specific CVC length validation:

Advanced: Data serializers

Use serializers to transform field data before submission: