🎉 Celebrate with 10% OFF on All Products! Use Code: GFEX10 Or Buy Any 2+ Items for 30% OFF with Code: GFEX30!

Gravity Forms Openpay Premium Add-on Setup Guide

Updated 13 min read Gravity Forms Integrations A–Z
On this page
  1. Countries and currencies
  2. How a payment works
  3. Install and activate
  4. Settings
  5. Getting your keys
  6. Webhooks
  7. The feed
  8. The form and the Openpay page
  9. Payment statuses
  10. The entry screen
  11. Refunds
  12. Testing in the sandbox
  13. Going live
  14. For developers
  15. How it differs
  16. Troubleshooting
  17. Uninstall

The Gravity Forms Openpay Premium Add-on lets your Gravity Forms take card payments through Openpay, the online payment service of BBVA, for businesses in Mexico, Colombia and Peru. When a form is submitted, the add-on creates an Openpay charge for the exact total in your country’s currency and sends the customer to the Openpay payment page, where they enter their card. Card details never touch your website. When the customer comes back, or when Openpay sends a webhook, the add-on reads the charge back from Openpay and only then marks the entry as paid. Refunds are made from the entry screen. This guide covers every setting, the feed, what happens during a payment, webhooks, refunds, testing in the sandbox and going live.

What you need

Gravity Forms 2.9 or newer, an Openpay account in Mexico, Colombia or Peru with its sandbox keys for testing (and production keys for live payments), the Gravity Forms currency set to your country’s currency, and a public site (https recommended) so Openpay webhooks can arrive.

Countries and currencies

Openpay runs a separate service in each country, and each account takes payments in its own currency. Choose your country in the settings; the add-on then uses the matching servers and currency for every charge, and refuses forms in any other currency before anything is sent.

Openpay country Currency Openpay servers (sandbox / live)
Mexico Mexican peso (MXN) sandbox-api.openpay.mx / api.openpay.mx
Colombia Colombian peso (COP) sandbox-api.openpay.co / api.openpay.co
Peru Peruvian sol (PEN) sandbox-api.openpay.pe / api.openpay.pe

Gravity Forms has Mexican pesos built in, but not Colombian pesos or Peruvian soles. The add-on adds both to the Gravity Forms currency list, with their own formats ($ 1.250.000,00 for Colombia and S/ 1,250.00 for Peru), so you can choose them in Forms → Settings and prices are read correctly. A currency another plugin already defines is left as it is.

Amounts are sent to Openpay as a number with at most two decimals (for example 1499.00 pesos), and the add-on keeps the exact amount on the entry in cents, so it can compare it with what Openpay reports to the cent. Totals below 1.00 are refused, and so are totals with more than two decimals.

How a payment works

  1. The customer fills in the form. Gravity Forms works out the total; the add-on checks that it is an amount in your Openpay currency with at most two decimals.
  2. The entry is saved with the status Processing. The add-on creates an Openpay card charge on your server for the total, with a unique order reference, a description, the customer’s name, email and phone, and a signed return address. The charge is created with confirm off, which tells Openpay to collect the card on its own payment page.
  3. Openpay answers with the charge and the address of its payment page. Before the customer is sent there, the add-on checks that the charge is waiting, carries the right order reference, amount and currency, and that the page is on an Openpay address of your country. If anything differs, the customer is told nothing was charged and the entry is marked Failed.
  4. The customer enters the card on the Openpay page (the bank may ask for an extra confirmation there). Card details never reach your website.
  5. Openpay sends the customer back to your form page. The add-on reads the charge from Openpay and shows your confirmation as soon as the charge is completed. Openpay also sends a webhook, which makes the add-on read the charge again.

Install and activate

  1. In WordPress go to Plugins → Add New → Upload Plugin, upload the zip and activate it.
  2. Open Forms → Settings → Openpay, enter your GravityExtra license key and activate it. The settings below appear once the license is active.
  3. Check Forms → Settings: the currency must be the one of your Openpay country.

Settings

Open Forms → Settings → Openpay. Each mode has its own merchant ID and private key; only the keys of the mode you choose are used for new charges. An entry always keeps the mode and country it was created in, so a charge started in Sandbox is still read from the sandbox after you switch to Live.

Openpay settings: the Openpay country, Sandbox or Live mode, the merchant ID and masked private key of each mode, the currency line, the connection line and the webhook address with its HTTP authentication user and password
Settings: choose the Openpay country and mode, paste the merchant ID and private key, and copy the webhook address, user and password into Openpay.
Setting What it does
Openpay country The country of your Openpay account: Mexico, Colombia or Peru. It decides which Openpay servers the add-on talks to and the currency of every charge (see the table above).
Mode Sandbox (the default) sends charges to the Openpay sandbox with your sandbox keys: payments are made with test cards and no money moves. Live uses your production keys for real payments.
Sandbox merchant ID and private key From the API keys of your Openpay sandbox dashboard. The merchant ID has 20 lowercase letters and digits; the private key starts with sk_. The public key (pk_) is not used and is refused if you paste it by mistake.
Live merchant ID and private key The same two values from your production dashboard, once Openpay has activated your account for live payments.
Currency A check line: the Gravity Forms currency must be the currency of your Openpay country (MXN, COP or PEN).
Connection Shows whether Openpay accepts the merchant ID and private key of the current mode for your country, with the merchant ID and the masked key.
Webhook The address, user and password to enter in the Openpay dashboard (see Webhooks below), the verification code Openpay sent, and when the last verified webhook arrived.

Getting your keys

  1. Sandbox: sign in to the Openpay sandbox dashboard of your country and open the API keys. Copy the merchant ID and the private key into the Sandbox fields and save. When you save, the add-on reads your merchant from Openpay with them (a read that changes nothing); the connection line turns green when Openpay accepts them.
  2. Production: once Openpay has approved your account for live payments, copy the merchant ID and private key from the production dashboard into the Live fields.
  3. The private keys are stored encrypted and only ever shown masked (the first four and the last four characters).

Webhooks

Openpay webhooks do not carry a signature. Instead, Openpay lets you protect the webhook address with HTTP authentication, and the add-on requires it: it creates a user and a long random password for you, and every webhook without exactly those credentials is refused. Even an authenticated webhook decides nothing on its own: the add-on reads the charge back from Openpay and checks it against the entry before anything changes. To set it up:

  1. Copy the webhook address, the user and the password from the Webhook block of the settings page.
  2. In the Openpay dashboard, open your business profile (click your name), go to Webhooks and choose Add webhook.
  3. Paste the address, turn on HTTP authentication and enter the user and password. Save.
  4. Openpay sends a verification code to the address. Reload the settings page: the code appears in the Webhook block. Back in Openpay, choose Verify and enter the code to activate the webhook.

Do the same in the production dashboard when you go live. If you ever need a new code, choose Forward code in Openpay.

The feed

Open your form, go to Settings → Openpay and add a feed. Choose Products and Services or Donations and the payment amount (usually the form total). Then map the customer fields: Openpay needs the customer’s first name and email for a charge on its payment page, and the last name and phone are added when you map them. A phone is sent as the national number of your country (ten digits in Mexico and Colombia, nine in Peru); a country code such as +52 is removed, and numbers that do not fit are left out.

The Openpay feed: products and services with the form total, the first name, last name, email and phone mapping, the charge description with merge tags and notifications after payment
The feed: map the customer’s name, email and phone and write the charge description.
  • Description: shown with the charge in Openpay, up to 250 characters. Merge tags work; the default is the form title and the entry number.
  • Notifications: tick Send form notifications only after the customer has paid to hold the usual form notifications until the payment is confirmed. They are sent once, when the entry becomes Paid.
  • Payment events: in the form notifications you can also choose Payment Completed, Payment Failed or Cancelled and Payment Refunded as the event.

The form and the Openpay page

Use Gravity Forms product, quantity, option and total fields as usual. The amount sent to Openpay is the total Gravity Forms calculated on your server, so a total changed in the browser cannot lower the price. The submit button can say Continue to payment, because the customer goes to the Openpay page next.

A ceramics workshop booking form with quantities, the customer name, email and phone, and the total in Mexican pesos, with the Continue to payment button
The form: Gravity Forms works out the total; the customer pays it by card on the Openpay page.

When the customer comes back, they see your normal confirmation as soon as Openpay reports the charge as completed. If the bank is still checking the card, a short waiting message checks again by itself for about a minute, then tells the customer that the entry updates by itself.

Payment statuses

What Openpay reports for the charge Entry
completed for the exact amount and currency, with the entry’s order reference Paid, with the Openpay charge id as the transaction id and the card brand and last four digits in the box
completed, but for another amount or currency Stays Processing with a note asking you to check the charge in your Openpay dashboard. It is never marked Paid on its own.
charge_pending or in_progress (the customer has not finished on the Openpay page yet) Processing. The return page checks again by itself, webhooks and the five-minute status check pick up the result.
failed (for example a declined card) Failed, with Openpay’s message in the box. No money was taken.
cancelled, or still unpaid after 48 hours Cancelled. No money was taken. If Openpay later reports the charge as completed, the entry still becomes Paid.
A refund on the charge Recorded once as a refund transaction with a note; Refunded when the whole amount was refunded.

The entry screen

Every Openpay entry has an Openpay box on the right with the status, the amount, the charge id, the order reference, the Openpay country, the card brand and last four digits, Openpay’s message if the card was declined, and any refund. Sandbox payments carry a Sandbox badge.

An entry paid through Openpay: the Openpay box with the status, amount, charge, order reference, country and card, the Refresh status button and the refund form, and the entry notes
The entry: status, charge, order reference and card, read back from Openpay, with refunds one click away.
  • Refresh status reads the charge from Openpay again and applies it.
  • Refund with Openpay sends a full or partial refund to the customer’s card. Type the amount (1499.00 or 1.499,00 both work; the field starts with the full amount) and confirm.

Refunds

Openpay keeps one refund per card charge, full or partial. Before it is sent, the add-on reads the charge from Openpay and checks that it is completed for the entry amount and has no refund yet. Each refund form can be used once, so a double click or a reloaded page cannot refund twice. The refund is recorded on the entry, as a transaction with a note, from Openpay’s answer; when the whole amount was refunded the entry becomes Refunded. If Openpay does not answer, the request is kept as waiting and the status check reads the charge until Openpay shows the refund (or, after an hour without one, frees it with a note). Refunds you make in the Openpay dashboard are recorded too, the next time the charge is read.

Testing in the sandbox

  1. Leave the mode on Sandbox and save your sandbox merchant ID and private key.
  2. Set up the sandbox webhook as described above and verify it.
  3. Open the form on your site, fill it in and continue to payment.
  4. On the Openpay sandbox page, pay with one of the test cards from the Openpay testing documentation.
  5. Back on your site, check the confirmation, then the entry: it should be Paid with the Sandbox badge, and the held notifications should have been sent.
  6. Pay another test entry with a test card that Openpay declines: the entry becomes Failed.
  7. Refund part of a paid test payment from the entry screen and watch it appear as a refund transaction.

Going live

  1. Paste the production merchant ID and private key into the Live fields.
  2. Add and verify the webhook in the production dashboard with the same address, user and password.
  3. Switch the mode to Live and save. The connection line should say Connected to Openpay with your country and Live.
  4. Make one small real payment, check the entry and refund it from the entry screen.

Your site must be reachable

Openpay sends webhooks to your site. On a local site or one behind a login, the return page, the status check and Refresh status still read the charge, but entries update fastest when webhooks arrive.

For developers

  • gravityextra_openpay_charge_fields filters the charge before it is sent. The description and the customer block can be changed; the amount, the currency, the order reference, the method, the confirm flag and the return address cannot, and a card source or other card fields are removed.
  • gravityextra_openpay_max_cents lowers the largest charge the site accepts, in cents (default 999,999.99 for MXN and PEN, 99,999,999.99 for COP).
  • gravityextra_openpay_rate_limit changes the per-visitor limits (payment starts 10, return page 30, webhooks 120 per minute).
  • gravityextra_openpay_payments_per_hour changes the site-wide cap of new charges per hour (300).
  • gravityextra_openpay_webhook_base changes the base of the webhook address (for a site behind a proxy).
// Put the workshop date in the Openpay charge description for one form (ID 7).
add_filter( 'gravityextra_openpay_charge_fields', function ( $charge, $feed, $entry, $form ) {
    if ( 7 !== (int) rgar( $form, 'id' ) ) {
        return $charge;
    }
    $charge['description'] = 'Workshop on ' . rgar( $entry, '8' ) . ' #' . rgar( $entry, 'id' );
    return $charge;
}, 10, 4 );

How it differs

  • Card details are entered on the Openpay page: the charge is created with confirm off, so no card number, token or card form is ever on your site.
  • Nothing is trusted from the browser or the webhook body: every result is read back from Openpay and checked against the entry’s order reference, amount and currency before the entry changes. The charge id Openpay adds to the return address is ignored; the entry’s own charge is read.
  • Openpay webhooks have no signature, so the webhook address is protected with an HTTP authentication user and password the add-on creates, compared in constant time; a repeated webhook is dropped, so a payment can only be completed once.
  • One add-on for Mexico, Colombia and Peru: the right servers and currency for your country, and every entry keeps the mode and country it was created in.
  • Keys are checked with Openpay when you save and stored encrypted; the public key is refused.
  • Refunds from the entry screen are checked against Openpay first, protected by a one-time form, and kept as waiting when Openpay does not answer, so a refund is never sent twice.
  • Payment creation, the return page and webhooks have per-visitor limits, and new charges have an hourly cap, so a flood of form posts cannot create charges without end.

Troubleshooting

What you see What to do
“Openpay did not accept this Sandbox merchant ID and private key for Mexico” Copy both values again from the same dashboard: sandbox values in the Sandbox fields and production values in the Live fields. Check that the Openpay country matches your account; a Colombian merchant ID is refused by the Mexican servers.
“This is the public key” Paste the private key, which starts with sk_. The public key (pk_) is only for card forms on your own pages, which this add-on does not use.
“Online payment is not available in USD” Set the Gravity Forms currency in Forms → Settings to the currency of your Openpay country: Mexican Peso, Colombian Peso or Peruvian Sol (the add-on adds the last two to the list while it is active).
No verification code appears after adding the webhook Check that the webhook address in Openpay is exactly the one on the settings page, that HTTP authentication is on with the user and password shown, and that your site is public. Some hosts drop the Authorization header; on Apache, a rewrite rule that passes HTTP_AUTHORIZATION fixes it. Then choose Forward code in Openpay.
Webhooks are refused with 401 The user or password in Openpay does not match the settings page. Copy them again.
Entries stay Processing after the customer paid Webhooks cannot reach a site that is not public (a local or password-protected staging site). Click Refresh status on the entry; the status check also reads waiting charges every five minutes.
“Too many payment attempts right now” A visitor started more than ten payments in a minute, or the site started more than 300 in an hour. Both limits can be changed with filters.

Uninstall

Uninstalling the add-on from Forms → Settings → Uninstall removes its settings (including the encrypted private keys), the webhook user and password, the verification code, the status check schedule, its locks, counters and cached checks. Entries, their notes and transactions stay in Gravity Forms, and charges and refunds at Openpay are not touched. Remove the webhook in the Openpay dashboard too.

Plans: one site $49 a year, five sites $69 a year, unlimited sites $199 a year. Questions? Contact GravityExtra support.

Still need help?

Our support team answers tickets every day, usually within a few hours.

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