# Connect Gravity Forms to Bayarcash

> Install Bayarcash for Gravity Forms, enter your keys and add a Bayarcash feed so your forms take FPX, DuitNow and other payments.
>
> Source: https://docs.bayarcash.com/gravity-forms/

**Bayarcash for Gravity Forms** adds Bayarcash to your Gravity Forms payment forms. Your customer fills in the form, picks a payment method, pays on the Bayarcash page and comes back to your form's confirmation.

To see the plugin at work before you install it, try the [live demo](https://form.bayarcash-demo.com/gravityforms/).

## What it supports

You choose which channels your customers see. The options in **Payment Channels** are:

| Channel | What your customer pays with |
|---|---|
| FPX Online Banking | FPX online banking |
| Credit/Debit Card | A credit card account through FPX |
| DuitNow Online Banking | DuitNow Online Banking/Wallets |
| DuitNow QR | Any DuitNow QR banking or e-wallet app |
| ShopeePayLater | SPayLater by Shopee |
| Boost PayFlex | Boost PayFlex |
| Indonesia Online Banking | Indonesian online banking (QRIS) |
| Indonesia E-Wallet | Indonesian e-wallets (QRIS) |
| NETS Singapore | NETS (Singapore) |

Payments are one-off and in MYR only. Subscriptions and Direct Debit are not supported. A channel only works if it is also turned on for your Bayarcash portal. See [Payment channels](/payment-channels/).

## Before you start

You need these before you set up the plugin:

- An approved Bayarcash merchant account.
- Your **Personal Access Token (PAT)**, **API Secret Key** and **Portal Key**. See [Find your API keys](/api-keys/).
- Gravity Forms installed and active, with the currency set to Malaysian ringgit (MYR).

## Install the plugin

The plugin is listed on WordPress.org as [Bayarcash for Gravity Forms](https://wordpress.org/plugins/bayarcash-for-gravity-forms/). To install it:

1. In WordPress, go to **Plugins** → **Add New**.
2. Search for **Bayarcash for Gravity Forms** and click **Install**.
3. Click **Activate**.

> **Note**
> This guide follows version 2 of the plugin. If your Bayarcash settings page has only **Personal Access Token (PAT)** and **Portal Key**, with no **API Secret Key** or **Payment Channels**, you have an older version. Ask Bayarcash support for the latest one.

## Enter your keys

Keys on the global settings page are used by every form that does not set its own:

1. Go to **Forms** → **Settings** → **Bayarcash**.
   
2. Paste your token into **Personal Access Token (PAT)** and click **Verify Token**. It shows "Token verified successfully!" when the token works.
3. Click **View Portal** and pick your portal from **Available Portals**. The plugin fills in **Portal Key** for you.
4. Paste your key into **API Secret Key**.
5. In **Payment Channels**, clear the channels you do not want. All are ticked to start with.
6. Leave **Enable Sandbox Mode** cleared for real payments.
7. Save.

## Add Bayarcash to a form

Each form that takes payments needs a Bayarcash feed. The form also needs a product or total field, and fields for the customer's name and email.

1. Open the form and go to **Settings** → **Bayarcash**, then add a new feed.
2. Give the feed a name.
3. In **Configuration Type**, choose **Global Configuration** to use the keys from the settings page. To use a different account or portal for this form only, choose **Form Configuration** and fill in the keys, channels and sandbox setting that appear.
4. Choose the transaction type and the payment amount.
5. Under **Client Information.**, map **Email** and **Full Name** to your form fields. **Phone Number** is optional.
6. Optional: map **Purhase Description** (spelt that way in the plugin) to a field whose text goes with the payment.
7. Optional: set a **Cancel URL**, the page your customer goes to if they cancel. Left blank, they go back to the form.
8. Save the feed.

When the form loads, your customer sees **Select Payment Method** with the channels you ticked. You can send emails on the **Payment Completed** and **Payment Failed** notification events.

## Test in sandbox

When **Enable Sandbox Mode** is ticked, payments go to the Bayarcash sandbox using test keys built into the plugin. The keys you entered are not used for the payment.

1. Tick **Enable Sandbox Mode** and save.
2. Submit your form and pay on the sandbox page.
3. When it works, clear **Enable Sandbox Mode**, save, and make one small real payment to check your own keys.

A feed set to **Form Configuration** has its own **Enable Sandbox Mode** box. Check it too.

## How payment results reach your site

You do not paste a callback URL into the merchant dashboard. The plugin sends its own address with each payment, on your site at `/?callback=bayarcash-for-gravity-forms`, and Bayarcash sends the result there. The plugin marks the entry paid, pending or failed, and adds a note to the entry.

If entries stay pending after a successful payment, make sure your site is public, uses HTTPS, and that no firewall or security plugin blocks that address. See [Callbacks and checksum](/callbacks-and-checksum/).

## Tips

Two habits help with Gravity Forms:

- **Always test once with your live keys.** Sandbox mode uses the plugin's own keys, so it does not prove your keys are right.
- **Use Form Configuration for separate campaigns.** A different portal per form keeps each campaign's payments apart in your Bayarcash reports.

## Common issues

### My form shows "Required fields (email and name) must be mapped in the feed settings."

Open the form's Bayarcash feed and, under Client Information., map Email and Full Name to fields on your form. Both are required.

### My form shows "Global Bayarcash settings are not properly configured."

The feed uses Global Configuration, but a key is missing on the global settings page. Go to Forms → Settings → Bayarcash and fill in Personal Access Token (PAT), Portal Key and API Secret Key. If the message says "Form-specific" instead, fill in the keys on the feed.

### Customers see "Payment gateway error. Please try again later." What happened?

Bayarcash refused the payment request, and the entry was not kept. Check your keys, and that the channels you ticked are turned on for your portal. See Why a payment failed (/payment-failed/).

### WordPress says required dependencies are missing and asks me to run composer install. What do I do?

The plugin files are incomplete. Delete the plugin and install it again from a complete copy supplied by Bayarcash.
