Taking card payments on your website with PayHere

PayHere integration explained for Sri Lankan businesses: how card payments work, what you need to apply, setup options, testing and going live.

Taking card payments on your website with PayHere

PayHere is a Sri Lankan payment gateway that lets your website accept card payments, such as Visa and Mastercard, and pays the money into your local bank account. A PayHere integration works like this: you apply for a merchant account, PayHere reviews your business and website, your web developer connects your site to PayHere using the details it gives you, you test with practice payments, and then you switch to live. Customers enter their card details on PayHere's secure payment page, so your website never has to store card numbers. This guide covers each stage and the details that trip people up.

How a card payment actually flows

It helps to know what happens when a customer in Galle clicks "Pay now" on your shop:

  1. Your website sends the order total and a reference number to PayHere.
  2. The customer is taken to PayHere's secure payment page and enters their card details there.
  3. The customer's bank checks the payment, sometimes with a one-time code sent to their phone.
  4. PayHere tells your website the result in the background, so the order is marked as paid even if the customer closes their browser.
  5. The customer returns to your site and sees a thank-you page, and both of you get a confirmation.
  6. PayHere pays the money, minus its fees, into your bank account on its settlement schedule.

Step four is the one that matters most for developers. A shop that only trusts the customer returning to the thank-you page can miss paid orders, or be tricked into marking unpaid ones as paid.

What you need before you apply

PayHere reviews every merchant before switching on live payments. Requirements can change, so check PayHere's own website for the current list, but be ready with:

  • Your business details: registered name, registration documents, address and contact person.
  • A Sri Lankan bank account in the business's name, for payouts.
  • A working website on your own domain, with real products or services and prices.
  • Policy pages: delivery, returns and refunds, privacy and terms and conditions.
  • Clear contact details on the site: phone, email and address.
  • HTTPS across the whole site. Our guide to SSL certificates and HTTPS explains what that means.

A half-built website full of placeholder text is likely to bring your application back with questions. Finish the site first, then apply.

Ways to do a PayHere integration

How you connect depends on what your website runs on.

Your websiteHow PayHere usually connectsGood for
WooCommerce (WordPress shop)A ready-made plugin, set up with your merchant detailsOnline shops with a product catalogue
Other shop platformsA plugin or app, where one is available for that platformShops already on another system
A simple website with no shopPayment links or a hosted payment page, where offeredClasses, deposits, invoices, one-off services
A custom-built systemPayHere's developer documentation and APIBooking systems, portals and apps

Check PayHere's website for which plugins and tools are currently offered. For a tuition institute in Kurunegala taking term fees, a simple payment link may be all you need. For a fashion store in Colombo with a large range of products, a WooCommerce shop with the plugin is the natural fit.

Testing before you go live

PayHere provides a sandbox, a practice version where you can make test payments without real money. Use it properly:

  1. Set your site to sandbox mode with the sandbox merchant details.
  2. Place a successful test order and check it is marked paid in your shop.
  3. Try a failed or cancelled payment and check the order is not marked paid.
  4. Check the confirmation emails reach both you and the customer.
  5. Test on a phone, since plenty of your customers will pay that way.
  6. Switch to your live merchant details, then place one small real order and refund it to confirm everything works end to end.

After you go live

Taking payments is only half of it. Plan for:

  • Refunds. Know how to issue one from your PayHere account and how it shows in your shop.
  • Settlements. Learn PayHere's payout schedule and match each payout against your orders in your accounts.
  • Disputes. If a customer disputes a charge with their bank, you will need to show proof of the order and delivery. Keep delivery records.
  • Fees. PayHere charges a fee on payments. Check PayHere's website for the current rates and build them into your pricing.
  • Keeping things updated. Plugins and website software need updating, and an outdated payment plugin is a risk.

Card payments or cash on delivery?

Cash on delivery is still familiar to many Sri Lankan customers, so plenty of shops offer both. Card payments mean money arrives before you ship, fewer refused parcels and less cash to handle. Our guide on how to start an online shop in Sri Lanka covers how payments, delivery and policies fit together.

How LankaByte handles it

Our Premium plan is a WooCommerce online shop that takes card payments through PayHere. We build the shop, set up the PayHere connection with your merchant details, test it with you, and keep the plugin and the site updated afterwards. The PayHere merchant account should be in your business's name, so payouts go straight to your own bank account. See the online shop page for what is included.

Questions people ask

Do I need a registered business to use PayHere?

PayHere asks for business details and documents when you apply, and the exact requirements depend on the type of business. Check PayHere's website for the current list for sole proprietors, partnerships and companies before you apply.

Does PayHere accept cards from overseas customers?

PayHere supports Visa and Mastercard, which are issued around the world, along with other methods. Whether a particular foreign card is accepted can depend on PayHere's settings for your account and the customer's bank. Check with PayHere if overseas customers are important to you.

Can I use PayHere without a full online shop?

Yes. If you only need to collect class fees, deposits or invoice payments, PayHere's payment links or hosted payment options can work without a product catalogue. Check PayHere's website for the tools currently available to merchants.

Keep reading

All guides