I'm trying to integrate CiviCRM with a payment gateway. I'm using the method notify where user will have to key in credit card detail in payment gateway website.

I have followed CiviCRM guide at

However i'm not clear on the return URL. In the payment gateway configuration I can enter the URL so that after the payment is made, it will redirect the user back to my CiviCRM website. However i'm clueless on the value that I should enter.


The payment gateway is senangPay.my (specific to Malaysia, accept visa/mastercard and bank account transfer). The guide for integration is available at http://guide.senangpay.my/manual-integration-api/

The still in progress plugin is available at:

Update 2 (implemented answer from Chris Burgess) Added handlePaymentNotification() but it does not seems to work. It does not execute the function. Refer to GitHub I just added redirect URL to thank you page. However when I tried it just return to main page. FYI when payment gateway redirect the user back to CiviCrm page it will redirect to http://civicrm.secretgroup.my/civicrm/payment/ipn?processor_name=senangpay&status_id=0&order_id=144283261515&transaction_id=14428326334290&msg=Your_payment_was_declined._Please_check_with_your_bank._Thank_you.&hash=07a5b4aa22b086bfe583f97474ca3401&component=event&contactID=39&contributionID=31&contributionTypeID=4&eventID=1&invoiceID=f237d39119b5c7f358127bbf8287e49f&membershipID=&participantID=13&qfKey=2f9e11313ad9d55bec78f759dfdad420_9895


  • 1
    Welcome to CiviCRM StackExchange! Thanks for asking - will write a reply below. You could perhaps expand your question by mentioning existing CiviCRM payment processors you've looked at, and maybe uploading your WIP to Github so you can link to it? Also, mentioning the specific payment gateway you're using may help people point you to existing solutions or help future users of the same find your work! Commented Sep 19, 2015 at 21:26

1 Answer 1


Where you return the user depends on your gateway's payment workflow. There are a couple of options.

If the user is returned without additional information (the gateway handles payment confirmation via direct comms between your server and theirs), then you can simply return the donor/registrant to the final "thanks" page.

If the user is returned with additional information (the gateway notifies of payment via some additional tokens / parameters in the browser redirect) then you might want to return the user to civicrm/payment/ipn, in which case you'll be implementing handlePaymentNotification() in your payment method.

If users are redirected back to the IPN you need to consider handling duplicate IPN attempts (browser reload, or IPN from both browser and gateway) by making sure you don't close off the transaction twice. You will probably also want to send an appropriate redirect for browser IPN so that the donor / registrant ends up on the right page eventually.

  • Include a link to your new extension's Github repo - the earlier you do this, the sooner you'll get useful feedback from the community! It's fine to publish before you're finished. Commented Sep 19, 2015 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.