Case study: Integrating payments in 2 hours

Case Study

Ben came to us wanting a SaaS payment integration with minimal effort — like any other startup he didn’t want to waste his development budget building something that is not core to the problem he’s solving, subscription payments.

With PayHere Ben was able to get recurring revenue integrated with his platform in a matter of hours! I’ll briefly dive into the technical details of how we integrate with

1. Payment URLs

It starts with a link, Ben has a monthly subscription setup on PayHere

We add a signup button on Bens website linking to this PayHere subscription page:

<a href=””> Get Started £20/month </a>

Once clicked the customer goes off to PayHere to fill in their card details and pay. We also offer embed pop-ups and bespoke integrations, but you can still have a great customer journey with just a link.

2. Webhooks

When customers payments succeed or fail we deliver webhooks to Bens servers (webhooks are free to use for any PayHere account). This allows us to react to successful payments and invite users to the platform. Below is a summary of the Ruby code on that listens for PayHere webhooks.

class PayhereWebhooksController < ApplicationController 
  skip_before_action :authenticate_user! 
  skip_before_action :verify_authenticity_token 
  def create 
    return head 401 unless valid_signature? 
    if payment_params[:status] == “success” 
      user = find_or_create_user 
      payment = find_or_create_payment_for(user) 
      UserMailer.welcome(user).deliver_later if new_user?
    head :no_content 

You can see the complete version here.

Welcome email

When successful payments come in for the first time Ben’s platform sends a welcome email to the customer allowing them to complete their account registration and gain access to the platform and all its superb content.

Start getting paid 🎉

PayHere is a super simple way to collect one-off and recurring payments with little or even no code required. You could be up and running in as little as 5 minutes!

We’re launching on Product Hunt today and would love you to check us out!

Fancy news and updates?

Sign up for our newsletter to stay up to date. We deliver infrequent product updates and tips on making the most of your online payments.

We care about protecting your data. See our Privacy Policy