🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!
Guides & Tutorials October 20, 2026

How to Accept Cardknox Card Payments With Gravity Forms

GravityExtra
How to Accept Cardknox Card Payments With Gravity Forms

Card payments on a WordPress site often mean a trade-off. Either you send customers away to a hosted payment page and lose some of them on the way, or you put card fields on your own form and take on the risk of card data passing through your server. Cardknox iFields remove that trade-off: the card fields sit on your form and look like the rest of it, but the card number and the CVV are typed into secure iframes served by Cardknox. Your site never sees them.

This tutorial shows how to take Cardknox payments on any Gravity Forms form with the Gravity Forms Cardknox Payment Gateway Premium Add-on. We build the forms of a small music school: a lesson package paid once, a monthly lesson plan with a registration fee, and a youth choir with a free first month. Along the way we look at test keys, declines, 3D Secure, refunds and how renewals reach your entries.

A Gravity Forms entry for a lesson package paid by card with Cardknox: the order with ten private guitar lessons for 240 dollars, the notes saying the payment was completed and approved through the iFields on the form with a Visa card ending in 1111, and on the right the Cardknox box with a test mode badge, status Paid, type one-time payment, the card, amount, reference and invoice, a refund amount with a Refund button and a Void payment button
The entry screen: payment notes and the Cardknox box with Refund and Void.

How a Cardknox Payment Works With iFields

A few steps happen between the click on the submit button and your confirmation page. Knowing them makes every setting easy to understand.

  1. The card goes to Cardknox. When the customer clicks the button, iFields sends the card number and the CVV from the iframes to Cardknox and receives single-use tokens in return.
  2. The form goes to your site. Gravity Forms sends the form with the tokens instead of the card. Name on card and expiry date travel as normal fields.
  3. The server charges the card. While the form is validated, the add-on works out the amount from your pricing fields and sends a sale to the Cardknox Transaction API with the tokens.
  4. The answer decides. Approved: the entry is saved as Paid. Declined: the customer sees a message on the form and can try another card. No entry is saved for a failed payment.

Because the tokens can be used only once and the add-on never stores them, there is nothing on your site that could be used to charge the card again. Subscriptions use a different, reusable token that stays inside the Cardknox recurring schedule.

What You Need

  • WordPress with Gravity Forms 2.9 or newer, on a site with HTTPS.
  • A Cardknox merchant account. Cardknox, now part of Sola Payments, gives developers a free sandbox account for testing.
  • Two keys from the Merchant Portal: an API key for the server and an iFields key for the browser.
  • The add-on, installed and activated with your GravityExtra licence.

Step 1: Create the Keys and Connect

In the Cardknox Merchant Portal, open Account Settings → Keys and create one API key and one iFields key for your sandbox account. Copy each key when it appears, because the portal will not show it again.

In WordPress, go to Forms → Settings → Cardknox, keep the mode on Test and paste both keys. When you save, the add-on checks the API key with Cardknox and shows a green line when it is accepted. The API key is stored encrypted and is never printed back into the page; the iFields key is public by design, because the browser needs it to load the card fields.

The Cardknox settings page: mode Test or Live, the test transaction key as a hidden password field saved encrypted, the test iFields key, empty live key fields, a green status line saying the test transaction key was accepted by Cardknox, the 3D Secure option, and the optional webhook section with the webhook address and the webhook PIN fields
Forms → Settings → Cardknox: keys per mode, key check, 3D Secure and the webhook.

Step 2: Build the Lesson Package Form

Our music school sells a package of ten private guitar lessons for 240 dollars. The form has a Name field, an Email field, a Phone field, an Address field, a Product field and a Total field. Then we add the Cardknox Card field from the Pricing Fields group.

On the live form the Cardknox Card field shows the name on card, the secure card number field, the expiry month and year, and the secure CVV field. The secure fields are styled to match normal inputs and format the card number with spaces as the customer types. A short line under the field tells customers that their card details go straight to Cardknox.

A lesson package form with name, email, mobile phone and billing address, the product Ten private guitar lessons at 240 dollars, the total, and the Card details field with the name on card, the secure Cardknox card number field, expiry month and year, the secure CVV field and a line saying card number and CVV never reach or stay on this site
The Cardknox Card field: card number and CVV are Cardknox iFields.

Step 3: Add the Cardknox Feed

Open the form’s Settings → Cardknox and add a feed. Choose Products and Services, use the form total as the amount and map the billing fields: first and last name, email, phone and the address. Cardknox uses these details in your transaction reports and for fraud checks, and it needs them for 3D Secure.

Two more settings are worth a look. The description is stored with the transaction in Cardknox, so a merge tag such as the student’s first name makes your reports easier to read. The Cardknox receipt option asks Cardknox to e-mail its own receipt to the customer, in addition to any Gravity Forms notification you send.

Step 4: Test Payments, Declines and Errors

Open the form and pay with one of the test card numbers from the Cardknox documentation and any future expiry date. With sandbox keys no real card is charged. Back on your site you see the confirmation, and the entry shows the status Paid, the Cardknox reference number, the card type and the last four digits.

Now try the paths that go wrong. In a sandbox account, Cardknox declines an amount of 9.91 and answers 9.92 with a gateway error, which makes both cases easy to test with a donation form where the visitor types the amount. A declined card shows a clear message right on the card field, and no entry is saved, so your entry list only contains real orders. If Cardknox cannot be reached at all, the customer is told that nothing was charged and can try again a minute later.

The add-on also checks a few things before it contacts Cardknox: a missing name on card, a missing or past expiry date, or card fields that were not filled in. Those mistakes are shown at once, without a request to the gateway.

Step 5: Turn On 3D Secure

3D Secure lets the card issuer confirm that the real cardholder is paying. When it is enabled for your Cardknox account, tick 3D Secure in the add-on settings. Most payments still go through without any extra step. When the issuer asks for a challenge, the form shows a short message and the bank window opens on the same page. The customer confirms, the form is sent again on its own, and the payment is finished. The entry notes whether the payment was authenticated.

The add-on binds each challenge to the form, the amount, the currency and the Cardknox reference, allows it once and lets it expire after 15 minutes. A changed basket or a replayed request is refused, and the customer is asked to enter the card again.

Step 6: A Monthly Plan With a Registration Fee

Our school also sells weekly piano lessons on a monthly plan for 120 dollars, with a one-time registration fee of 35 dollars. The form is the same as before, with a second Product field for the fee. In the feed, choose Subscription, pick the lesson product as the recurring amount, set the billing cycle to one month and the recurring times to twelve, and turn on the setup fee with the registration product.

When a parent signs up, the first payment of 155 dollars is charged on the form. Then the add-on creates a Cardknox recurring schedule with the card from that payment: 120 dollars every month, starting next month, for the eleven remaining payments. The entry is saved as Active with the schedule id. Because the schedule starts one cycle later, nobody is charged twice in the first month.

A free first month

For the youth choir the first month is free. Turn on the trial and set its amount to zero. The add-on then saves the card with Cardknox without charging it and creates the schedule for the monthly fee from next month. If the trial has a price, that price is charged on the form instead of the recurring amount.

Step 7: Renewals, Cancellations and the Webhook

Cardknox runs the schedule and charges the card on each due date. Twice a day the add-on reads the transactions of every active schedule and adds each new one to its entry: approved renewals as subscription payments, declined ones as failed payments with the reason. You can also click Refresh renewals from Cardknox on the entry for an instant check. When the last payment of a schedule has run, the entry becomes Expired; when the schedule is stopped in the Cardknox portal, it becomes Cancelled. Cancelling the subscription in Gravity Forms stops the schedule at Cardknox.

If you want updates within a minute, set up the Cardknox webhook. Paste the address from the add-on settings as the Postback URL in the Cardknox portal and choose a PIN. Every notification is checked against the PIN, and a valid one simply starts the same check from the API. Nothing in a webhook can change an entry by itself.

Step 8: Refunds and Voids

Plans change: a student moves away, a lesson is cancelled. Open the entry and use the Cardknox box. Before the batch settles, usually on the same day, Void payment cancels the payment completely and the customer never sees the charge. After settlement, Refund returns all or part of the amount; refund in parts as often as you need until the full amount is returned. Each button asks for confirmation and uses a one-time request id, so a double click never refunds twice.

Step 9: Go Live

When the test payments, declines, refunds and a renewal check all work, paste the API key and iFields key of your production account, switch the mode to Live and save. Make one small real payment and refund it to be sure. Entries paid in Test mode keep their test badge and still refund against the sandbox account.

Tips for Card Forms

  • Ask only for what you need. Name, email and the billing address are enough for most payments; add the phone number when you use 3D Secure.
  • Say what happens next. A line under the button such as “you will be charged 155 dollars today and 120 dollars every month” prevents surprised e-mails.
  • Hold back notifications for failed payments. Since no entry is saved for a declined card, your team only gets e-mails for real orders.
  • Use the payment events. Send the parent a welcome e-mail when a subscription is created, and your office a note when a renewal fails.

Frequently Asked Questions

Is card data stored on my site?

No. The card number and CVV are typed into Cardknox iFields and replaced by single-use tokens before the form is sent. The add-on stores the reference number, the card type and the last four digits only.

Does it work with currencies other than US dollars?

Yes, for currencies with two decimals, when your Cardknox account takes them. The add-on sends the currency code with each payment and each schedule.

Can customers pay by bank account?

Version 1.0 takes card payments. The Cardknox Card field is built for credit and debit cards.

Which Gravity Forms version do I need?

Gravity Forms 2.9 or newer, any licence, with WordPress 6.5 and PHP 7.4 or newer.

Take Cardknox Card Payments in Gravity Forms

Secure iFields, one-time payments, recurring schedules, 3D Secure, refunds and voids, all inside Gravity Forms.

0
0
Your Cart
Your cart is emptyReturn to Shop
🔥 FREQUENTLY BOUGHT TOGETHER
Complete Combo & Save 40%!
ITEM IN YOUR CART
Gravity Forms Klaviyo Add-on
$39.00/yr
+
🎁 RECOMMENDED ADD-ON SAVE 40% OFF
Original Price: $39.00/yr
Bundle Special Price: $23.40/yr