Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
minLevel2
maxLevel2

Feature

Use Case

Level II Fields

Include additional data with transactions to qualify for better interchange rates.

Billing Address

Add billing address fields and prefill them if applicable.

Customization

Set the styles and contents for the payment fields.

Card Swipe Popup

Add a popup to support collecting payment data using a compatible card reader.

Transaction Submit Button

Add a preconfigured submission button that makes it easy to build a payment page.

Zero Dollar Auth

Check the validity of a payment method or obtain authorization for a transaction without actually charging the customer's account.

Tokenization

Create card tokens for automatic and recurring payments.

ACH

Accept payments using a customer’s bank account information.

Invoices

Pay and invoice using PayFields.

Customer Account Creation

Save customer records with tokenized payment information.

For definitions of the PayFields actions, including the transaction result callback functions, see the Developer Guide.

...

The table below defines the classes and IDs available for styling PayFields elements:

Code Snippet

Field Description

Type

".input"

All Fields

Class

".number"

Number Field

Class

".expiration"

Expiration Field

Class

".cvv"

CVV Code Field

Class

".name"

Cardholder Name Field

Class

".address-input"

All Cardholder Address Fields

Class

".address1"

Address 1

Class

".city"

City

Class

".state"

State

Class

".zip"

Zip

Class

".email"

Email

Class

".phone"

Phone

Class

".form-error"

All Error Spans

Class

".number-error"

Card Number Error Span

Class

".expiration-error"

Card Expiration Error Span

Class

".cvv-error"

Card CVV Error Span

Class

".name-error"

Cardholder Name Error Span

Class

".address-form-error"

All Address Error Span

Class

".address1-error"

Address 1 Error Span

Class

".city-error"

City Error Span

Class

".state-error"

State Error Span

Class

".zip-error"

Zip Code Error Span

Class

".email-error"

Cardholder Email Error Span

Class

".phone-error"

Phone Number Error Span

Class

".card-icon"

Credit Card Icon

Class

"#payFields-iframe-swiper"

Swiper iFrame

ID

Card Swipe Popup

The card swipe popup opens a separate modal that supports collecting payment information from an unencrypted card reader. The image below shows the card swipe popup:

...

Note

Keyboard Emulation Required

To use the Card swipe feature with PayFields, the swiper needs to be configured for KBE (Keyboard Emulation).

PayFields supports two ways to launch the card swipe popup: the PayFields.swipePopup(); function and the card swipe popup button.

The sections below provide examples of each:

...

Use zero dollar auth transactions to obtain approval for a payment method without actually charging the cardholder’s account. Zero dollar auth transactions are a component of setting up automatic and recurring payments. Follow the steps below to perform zero dollar auth transaction:

  1. Set the PayFields transaction mode to 'txn' as shown below:

    Code Block
    PayFields.config.mode = 'txn';
  2. Set the transaction amount to `0` as shown below. Use a string for the amount:

    Code Block
     PayFields.config.amount = '0';
  3. Set the transaction type to 'auth':

    Code Block
    PayFields.config.txnType = 'auth';

Tokenization

The PayFields tokenization feature makes it possible to store a reference to payment information that can be used to process automatic or recurring payments. PayFields supports token only and transaction+token functions.

...

.

The sections below provide examples of how to generate tokens using PayFields.

...

Code Block
PayFields.config.amount = '0';
PayFields.config.mode = 'txnToken'; 

ACH

The information below provides an overview of the PayFields ACH feature. See the Accept ACH Payments With PayFields page for details about building a payment page that accepts ACH payments.

...

Transaction with Token Hash Only

Info

It is also possible to use PayFields with an existing customer token hash. There are no PayFields.fields set up, rather the PayFields.config.token logic is listed directly under the APIKEY and merchant ID. If fields such as “number” are listed in the fields array and the HTML is set up correctly to correspond to the number field, Payrix will query a masked number to display in the number input field.

Code Block
PayFields.config.txnTypetoken = 'ecsale';

...

Code Block
languagejs
PayFields.config.fieldsapiKey = [
    {
        type: "routing",
        element: "#routing",
    },
    {
        type: "account_type",
        element: "#account_type",
    },
    {
        type: "account_number",
        element: "#account_number",
    },
    {
        type: 'name',
        element: '#name',
        values: { name: 'John Wayne' }
    },
    {
        type: 'address',
        element: '#address',
        values: {
            email: 'one@two.com',
            city: 'New York'
        }
    }
];''
PayFields.config.merchant = ''
// Token hash to run the transaction against a specific customers method of payment
PayFields.config.token = "Token Hash Here"
// Query Selector to grab submit button element
let submit = document.querySelector('#submit');
// Use event listener to call PayFields.submit()
submit.addEventListener('click', function() {
    // Set an amount to config.mode is either txn || txnToken
    PayFields.config.amount = 415
    // Select transaction type (auth / sale)
    PayFields.config.txnType = 'auth'
    // Set the mode (txn, txnToken, token)
    PayFields.config.mode = 'txn'
    // Call submit
    PayFields.submit();
})
PayFields.onSuccess = (response) => {
    console.log(response)
}

Invoicing

Use the PayFields.config.invoiceResult object to apply a full or partial payment to an invoice:

...

Code Block
languagejs
PayFields.config.customer = {
  first: "Henry",
  middle: "Middle",
  last: "Kevin",
  company: "Another Company, Inc.",
  custom: "Checking",
  email: "testing@gmail.com",
  phone: "1112223334",
  fax: "1234567890"
}

The value for PayFields.config.mode must be set to token to create a customer account. Customer accounts cannot be created if mode is set to txnTokenIf customerID is not passed with the transaction, in either mode, a new customer account will be created.

DOM Styling

Certain fields can be hidden by setting display: "none" in the PayFields.customizations.style object when you are prepopulating fields using the PayFields.array. The sample code below shows all of the fields that can be hidden:

...