# Connect GiveWP to Bayarcash

> Install the Bayarcash GiveWP plugin to collect one-off donations by FPX, DuitNow and more, and recurring donations by Direct Debit.
>
> Source: https://docs.bayarcash.com/givewp/

The **Bayarcash GiveWP** plugin adds Bayarcash to your GiveWP donation forms. Donors can give once by FPX, DuitNow and other channels, or give every week or month by Direct Debit.

Recurring donations need the [Recurring Donations for GiveWP](https://givewp.com/addons/recurring-donations/) add-on. Bayarcash then deducts each donation from the donor's bank account by itself, at a flat-rate fee. See [Recurring donations by Direct Debit](#recurring-donations-by-direct-debit).

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

## What it supports

Each Bayarcash channel is a separate GiveWP payment gateway. You can turn on as many as you like:

| Gateway in GiveWP | What the donor pays with |
|---|---|
| **Online Banking** | FPX online banking. Also runs recurring donations by Direct Debit. |
| **Online Banking (DuitNow)** | DuitNow Online Banking/Wallets |
| **Credit Card** | FPX Line of Credit: a credit card account through FPX, not a card payment. See [FPX Line of Credit](/fpx-line-of-credit/) |
| **DuitNow QR** | Any DuitNow QR banking or e-wallet app |
| **Boost PayFlex** | Boost PayFlex |
| **Indonesia Online Banking** | Indonesian online banking (QRIS) |
| **Indonesia e-Wallet** | Indonesian e-wallets (QRIS) |
| **NETS** | NETS (Singapore) |
| **Alipay** | Alipay |
| **WeChat Pay** | WeChat Pay |
| **PromptPay** | PromptPay (Thailand) |

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/).
- GiveWP installed and active, with the currency set to Malaysian ringgit (MYR).
- For recurring donations, the GiveWP Recurring Donations add-on.

## Install the plugin

The plugin is free on WordPress.org as [Bayarcash GiveWP](https://wordpress.org/plugins/bayarcash-givewp/). To install it:

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

## Enter your keys

The Bayarcash settings page has one tab per channel, and each tab keeps its own keys. Fill in the tab of every channel you want to use:

1. Go to **Donations** → **Settings** → **Payment Gateways**, then open the **Bayarcash** section.
   
2. Click the channel's tab, for example **Online Banking**.
3. Paste your token into **Personal Access Token (PAT)** and click **Verify Token**. It shows "PAT Token is valid" when the token works.
4. Choose your portal in **Portal Key**. The list fills in once the token is valid.
5. Paste your key into **API Secret Key**.
6. Optional: set **Billing Fields** to **Enabled** to ask donors for their billing details, and **Enable Phone field** to **Enabled** to ask for a phone number on one-off donations.
7. Click **Save changes**.

## Turn on the gateways

The keys alone do not show Bayarcash on your forms. Turn on each gateway in GiveWP too:

1. In **Donations** → **Settings** → **Payment Gateways**, open GiveWP's list of gateways.
2. Tick each Bayarcash gateway you set up, for example **Online Banking** and **DuitNow QR**.
3. Optional: rename the label donors see, for example to "Online Banking (FPX)".
4. Save.

## Use different keys on one form

Each donation form can use its own Bayarcash account or portal, which helps when you want each campaign's money reported separately. In the form editor, open the Bayarcash channel's tab and choose an option:

| Option | When to use it |
|---|---|
| **Global Option** | Use the keys from the Bayarcash settings page. |
| **Customize** | Enter a different **Personal Access Token (PAT)**, **Portal Key** and **API Secret Key** for this form only. |
| **Disable** | Hide this channel on this form. |

## Test in sandbox

The plugin follows GiveWP's test mode. When test mode is on, every Bayarcash payment goes to the Bayarcash sandbox, using the keys you entered:

1. Get a token, secret key and portal key from the [sandbox merchant dashboard](https://console.bayarcash-sandbox.com). Live keys do not work in the sandbox.
2. Turn on GiveWP's test mode.
3. Enter the sandbox keys on the Bayarcash settings page and save.
4. Make a test donation.
5. When it works, turn off test mode, enter your live keys and save again.

## 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 donation, on your site at `/give-api/bayarcash_gateway/`, and Bayarcash sends the result there. The plugin also re-checks pending donations every 5 minutes.

If donations 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/).

## Recurring donations by Direct Debit

With the GiveWP Recurring Donations add-on, donors can give every week or every month by Direct Debit. The donor signs an e-mandate once, and Bayarcash deducts each donation from their bank account.

To take recurring donations:

1. Install and activate GiveWP Recurring Donations.
2. Set up the **Online Banking** gateway as above.
3. Make the form recurring, with a weekly or monthly period.

On a recurring form the donor fills in **Phone Number**, **Identification Type** and **Identification Number**, then approves the e-mandate with their bank. Their bank account is charged a small, non-refundable verification amount, and the receipt says so. See [Direct Debit deduction schedule](/direct-debit-deduction-schedule/) and [e-Mandates](/e-mandates/).

## Tips

Two habits help with donations:

- **Use a separate portal for each campaign.** A per-form portal keeps each campaign's donations apart in your Bayarcash reports.
- **Keep donor emails short on recurring forms.** Direct Debit takes emails of up to 27 characters, so a long address blocks the donation.

## Common issues

### Verify Token says "Invalid PAT Token". What is wrong?

The token is wrong, or it comes from the other environment. With GiveWP test mode on, use a token from the sandbox merchant dashboard. With it off, use a token from the live merchant dashboard. See Find your API keys (/api-keys/).

### Donors see "Email length reaches a limit of 27 characters." What does it mean?

For recurring donations by Direct Debit, the donor's email can be at most 27 characters. For one-off donations the limit is 50. Ask the donor to use a shorter email address.

### Donors see "Please tick the create account button if you want to create a subscription donation".

A recurring donation needs a donor account. The donor should tick the option to create an account on the donation form, then try again.

### I only see the Online Banking option on my recurring form. Where are the other channels?

Recurring donations are collected by Direct Debit, which runs through the Online Banking gateway. The other Bayarcash channels are hidden on recurring forms and only take one-off donations.
