# Connect WooCommerce to Bayarcash

> Install the Bayarcash WC plugin, enter your keys for each payment channel you want and take FPX, DuitNow, card, e-wallet and Direct Debit payments.
>
> Source: https://docs.bayarcash.com/woocommerce/

The **Bayarcash WC** plugin adds Bayarcash to your WooCommerce checkout. Each Bayarcash payment channel is a separate WooCommerce payment method with its own settings page and its own keys, so you set up only the channels you want.

The plugin fully supports [WooCommerce Subscriptions](https://woocommerce.com/products/woocommerce-subscriptions/) products. Your customers can pay each renewal by Direct Debit, straight from their bank account. See [Direct Debit for subscriptions](#direct-debit-for-subscriptions).

## What it supports

The plugin adds one WooCommerce payment method per channel. This is the name you see in **WooCommerce** → **Settings** → **Payments**, and the title your customers see at checkout until you change it:

| Payment method in WooCommerce | Default checkout title | What your customer pays with |
|---|---|---|
| **Bayarcash FPX** | Online Banking | FPX online banking |
| **Bayarcash DuitNow OBW** | Online Banking | DuitNow Online Banking/Wallets |
| **Bayarcash FPX Line of Credit** | FPX Line of Credit | A credit card account through FPX |
| **Bayarcash Credit & Debit Card** | Credit & Debit Card | Visa or Mastercard |
| **Bayarcash DuitNow QR** | DuitNow QR | Any DuitNow QR banking or e-wallet app |
| **Bayarcash Shopee Pay** | SPayLater / Shopee Pay | ShopeePay or SPayLater |
| **Bayarcash BNPL by Boost** | Boost PayFlex | Boost PayFlex |
| **Bayarcash Boost PayFlex** | Boost PayFlex | Boost PayFlex and Boost Wallet |
| **Bayarcash Touch 'n Go eWallet** | Touch 'n Go eWallet | Touch 'n Go eWallet |
| **Bayarcash GrabPay** | GrabPay | GrabPay |
| **Bayarcash Grab PayLater** | Grab PayLater | PayLater by Grab |
| **Bayarcash QRIS Online Banking** | Indonesia Online Banking | Indonesian online banking (QRIS) |
| **Bayarcash QRIS e-Wallet** | Indonesia e-Wallet | Indonesian e-wallets (QRIS) |
| **Bayarcash NETS Singapore** | NETS Singapore | NETS (Singapore) |
| **Bayarcash Alipay** | Alipay | Alipay |
| **Bayarcash WeChat Pay** | WeChat Pay | WeChat Pay |
| **Bayarcash PromptPay Thailand** | PromptPay | PromptPay (Thailand) |
| **Bayarcash Direct Debit** | Recurring Direct Debit | Weekly or monthly deductions from a bank account |

**Bayarcash Direct Debit** only appears when WooCommerce Subscriptions is active. A channel only works if it is also turned on for your Bayarcash portal. See [Payment channels](/payment-channels/) and [Cross-border payment channels](/cross-border-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/).
- WooCommerce installed and active, with the store currency set to Malaysian ringgit (MYR).
- A site that is online and served over HTTPS, so Bayarcash can send payment results back to it.

## Install the plugin

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

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

## Set up a payment channel

Repeat these steps for every channel you want to offer. Each channel's settings page has its own copy of every field below.

1. Go to **WooCommerce** → **Settings** → **Payments** and open the Bayarcash channel you want, for example **Bayarcash FPX**.
   
2. Tick **Enable/Disable**.
3. Leave **Sandbox Mode** cleared for real payments. See [Test in sandbox](#test-in-sandbox) below.
4. Optional: change **Title** and **Description**, the text your customer sees at checkout.
5. Under **Credentials**, paste your token into **Personal Access Token (PAT)**. The plugin checks it and shows "PAT Token is valid". You can also click **Verify Token**.
6. Choose your portal in **Portal Key**. The list fills in once the token is valid.
7. Paste your key into **API Secret Key**.
8. Click **Save changes**.
   

> **Tip**
> Already set up one channel? On the next one, choose that channel in **Copy Credentials** and click **Copy**. It copies the token, secret key, portal key and **Sandbox Mode** setting in one go.

## Optional settings

Each channel also has these settings, under **Miscellaneous** and **Additional Charges**:

| Setting | What it does |
|---|---|
| **Country Restrictions** | Shows the channel only to customers from one country. **Off** shows it to everyone. |
| **Email Fallback** | The email sent to Bayarcash when your checkout does not ask the customer for one. |
| **Debug Mode** | Writes extra detail to the WooCommerce logs (**WooCommerce** → **System Status** → **Logs**) for troubleshooting. |
| **Place Order Text** | The checkout button text. `{total}` shows the cart total. |
| **Logo Size Unit** and **Logo Size** | The size of the channel logo at checkout. |
| **Enable Additional Charges** | Adds a fee to the order when the customer pays with this channel, set with **Fee Name**, **Charge Type** and **Charge Amount**. |

To take payments into more than one Bayarcash account, use the **Bayarcash Multi-Merchant** tab in **WooCommerce** → **Settings**. It adds extra FPX and DuitNow payment methods, each with its own keys.

## Test in sandbox

Test on the Bayarcash sandbox before you take real payments:

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. On the channel's settings page, tick **Sandbox Mode**, enter the sandbox keys and click **Save changes**.
3. Place a test order and pay it.
4. When it works, clear **Sandbox Mode**, enter your live keys and save again.

Sandbox mode is set per channel, so check each channel you tested.

## How payment results reach your store

You do not paste a callback URL into the merchant dashboard. The plugin sends its own return and callback address with each payment, on your site at `/?wc-api=bayarcash_callback`. When the payment ends, Bayarcash sends the result there and the plugin updates the order. It also re-checks unpaid orders on a schedule.

If orders stay pending after a successful payment, make sure your site is public, uses HTTPS, and that no firewall, security plugin or maintenance mode blocks `?wc-api=` addresses. See [Callbacks and checksum](/callbacks-and-checksum/).

## Direct Debit for subscriptions

Bayarcash Direct Debit works with WooCommerce Subscriptions. The customer signs an e-mandate once, and Bayarcash then deducts each renewal from their bank account.

To use it:

1. Install and activate WooCommerce Subscriptions.
2. Set up **Bayarcash Direct Debit** like any other channel.
3. Create subscription products billed every week or every month. Other billing periods are refused at checkout.

At checkout the customer fills in **Identification Type** and **Identification Number**, then approves the e-mandate with their bank. Their bank account is charged a small verification amount, and the order note says whether bank verification passed. A cart can hold one subscription and no other items.

For when deductions happen and how to follow them, see [Direct Debit deduction schedule](/direct-debit-deduction-schedule/) and [Direct Debit transactions](/direct-debit-transactions/).

## Tips

Two habits make a WooCommerce setup smoother:

- **Set up only the channels your portal can take.** A channel that is not turned on for your portal shows a warning in its settings and fails at checkout.
- **Use a separate portal for each shop.** Reports and payouts are easier to reconcile when each site has its own portal.

## Common issues

### I saved my settings but the payment method is switched off again. Why?

The plugin turns a channel off when Personal Access Token (PAT), Portal Key or API Secret Key is empty, and shows "Please enter portal key", "Please enter Personal Access Token (PAT)" or "Please enter API secret key". Each channel keeps its own keys, so fill in all three on that channel's settings page, or use Copy Credentials.

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

The token is wrong, or it comes from the other environment. With Sandbox Mode ticked, use a token from the sandbox merchant dashboard. With it cleared, use a token from the live merchant dashboard. See Find your API keys (/api-keys/).

### A channel shows a warning that it "is not enabled for this portal". What do I do?

The portal you picked cannot take that channel yet. Choose a different portal, or ask Bayarcash to turn the channel on for this portal. See Payment channels (/payment-channels/).

### Customers see "This payment method only supports Malaysian Ringgit (MYR) currency." at checkout.

Bayarcash takes payments in MYR only. Set your store currency to Malaysian ringgit (MYR) in your WooCommerce general settings.

### I cannot cancel a Direct Debit order. Why?

The plugin blocks it and shows "Direct Debit orders cannot be cancelled." To stop future deductions, cancel the subscription instead, or end the e-mandate. See Change or end a Direct Debit mandate (/direct-debit-maintenance-termination/).
