Payhere coupons for referral rewards?

I’m trying to find the best way to incorporate a referral program for my app. I am using payhere to process subscription payments, so I wondered if it’s feasible to generate unique coupon codes for each user, and then populate that on a tab where they share a link to the app or a landing page along with their unique coupon. 2 challenges:

  1. I think I’ll have to manually add the coupon into my Payhere account for each new user.
  2. Though it seems possible for integromat to send that coupon code into my spreadsheet and tie that back to the original user who referred the new user…I’m not sure how to process the reward, which I’m thinking would be 2 months free or something along those lines.

Any advice? Is there a better way?

You can send hidden values via Payhere. Only complication is that the values need to be encoded into base64 and sent along via the payment link. I imagine this hidden value (rowID of the users sheet?) can then end up in your sheet via Integromat. Then relate this value in the users sheet to the value in the Payhere sheet to see total number of referred users.

1 Like

I think I’m tracking with you. I do want to use something much shorter than the rowID. For now I think I’ll try a random 6 digit number. Needing help with the formula however. The following provides the same number for everyone. How do I make this different for each user.

={“Referral Code”;ArrayFormula(IF(LEN(A2:A),RANDBETWEEN(100000,999999), “”))}

Might be easier to take the first 3 characters of the rowID and then add the rowNumber formatted in 3 digits. I’ll create it for you in your sheet.


If you still want that this is the formula, but it uses a random formula so it won’t stick.

={"Referral Code";ArrayFormula(IF(LEN(A2:A),RANDBETWEEN(ROW(A2:A),999999), ""))}


Awesome. I’ll make sure to reward you handsomely when the referrals go nuts and we exceed 9999 users :wink:

1 Like

Also can we substitute “-” as well? Maybe with “B”.

You bet.

Done. The only flaw in this schema is if you delete/reorder user rows. Then the ROWnumbers will change and no longer align to the referrals…might need a more reliable solution.

1 Like

Thanks Robert for helping me resolve that last issue with the onboarding set column from a temporary code column. My next dilemma with Payhere is tracking conversions. I need to track successful payments with Google analytics but it seems the U-code I entered on Payhere (“Settings” then “personalize”) only tracks people who reach the payment link, but not those who reach the next “Thanks You” page. Anyone have experience on that end?

Payhere finally got back to me on this tracking issue for those who care. Apparently it can’t be done with the actual page view since the url doesn’t change on the thank you page, but they have enabled an ecommerce tracker, so there is a setting in analytics that has to be clicked for it to work.