...
Table of Contents | ||||
---|---|---|---|---|
|
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 |
---|---|---|
| All Fields | Class |
| Number Field | Class |
| Expiration Field | Class |
| CVV Code Field | Class |
| Cardholder Name Field | Class |
| All Cardholder Address Fields | Class |
| Address 1 | Class |
| City | Class |
| State | Class |
| Zip | Class |
| Class | |
| Phone | Class |
| All Error Spans | Class |
| Card Number Error Span | Class |
| Card Expiration Error Span | Class |
| Card CVV Error Span | Class |
| Cardholder Name Error Span | Class |
| All Address Error Span | Class |
| Address 1 Error Span | Class |
| City Error Span | Class |
| State Error Span | Class |
| Zip Code Error Span | Class |
| Cardholder Email Error Span | Class |
| Phone Number Error Span | Class |
| Credit Card Icon | Class |
| 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:
Set the PayFields transaction mode to
'txn'
as shown below:Code Block PayFields.config.mode = 'txn';
Set the transaction amount to
`0`
as shown below. Use a string for the amount:Code Block PayFields.config.amount = '0';
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 | ||
---|---|---|
| ||
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 | ||
---|---|---|
| ||
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 txnToken
If 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:
...