Answers.Body: <p>Where you return the user depends on your gateway's payment workflow. There are a couple of options.</p>
  
  <p>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.</p>
  
  <p>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 <code>civicrm/payment/ipn</code>, in which case you'll be implementing <code>handlePaymentNotification()</code> in your payment method.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-19T21:55:14.337Z
Answers.Text: 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.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-19T21:55:08.947Z
Answers.LastActivityDate: 2015-09-19T21:55:08.947Z
Answers.UserDisplayName: Chris Burgess
Body: <p>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.</p>
  
  <p>I have followed CiviCRM guide at </p>
  
  <ul>
  <li><a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Example+of+creating+a+payment+processor+extension" rel="nofollow">CiviCRM Wiki: Example of creating a payment processor extension</a></li>
  <li><a href="http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Payment-Processor+Extension" rel="nofollow">CiviCRM Wiki: Create a payment processor extension</a></li>
  </ul>
  
  <p>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.</p>
  
  <p><strong>Update</strong></p>
  
  <p>The payment gateway is <a href="http://senangpay.my" rel="nofollow">senangPay.my</a> (specific to Malaysia, accept visa/mastercard and bank account transfer). The guide for integration is available at <a href="http://guide.senangpay.my/manual-integration-api/" rel="nofollow">http://guide.senangpay.my/manual-integration-api/</a></p>
  
  <p>The still in progress plugin is available at:</p>
  
  <ul>
  <li><a href="https://github.com/zulazri/senangPay_CiviCRM" rel="nofollow">https://github.com/zulazri/senangPay_CiviCRM</a></li>
  </ul>
  
  <p><strong>Update 2 (implemented answer from Chris Burgess)</strong>
  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 <a href="http://civicrm.secretgroup.my/civicrm/payment/ipn?processor_name=senangpay&amp;status_id=0&amp;order_id=144283261515&amp;transaction_id=14428326334290&amp;msg=Your_payment_was_declined._Please_check_with_your_bank._Thank_you.&amp;hash=07a5b4aa22b086bfe583f97474ca3401&amp;component=event&amp;contactID=39&amp;contributionID=31&amp;contributionTypeID=4&amp;eventID=1&amp;invoiceID=f237d39119b5c7f358127bbf8287e49f&amp;membershipID=&amp;participantID=13&amp;qfKey=2f9e11313ad9d55bec78f759dfdad420_9895" rel="nofollow">http://civicrm.secretgroup.my/civicrm/payment/ipn?processor_name=senangpay&amp;status_id=0&amp;order_id=144283261515&amp;transaction_id=14428326334290&amp;msg=Your_payment_was_declined._Please_check_with_your_bank._Thank_you.&amp;hash=07a5b4aa22b086bfe583f97474ca3401&amp;component=event&amp;contactID=39&amp;contributionID=31&amp;contributionTypeID=4&amp;eventID=1&amp;invoiceID=f237d39119b5c7f358127bbf8287e49f&amp;membershipID=&amp;participantID=13&amp;qfKey=2f9e11313ad9d55bec78f759dfdad420_9895</a></p>
  
  <p>Thanks!</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-19T21:26:00.370Z
Comments.Text: 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!
Comments.UserDisplayName: Chris Burgess
Tags: <payment-processor>
Title: Payment Gateway return URL
ThreadText: # Payment Gateway return URL
  
  (Asked by: username_0 on 2015-09-19)
  
  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
  
  * [CiviCRM Wiki: Example of creating a payment processor extension](http://wiki.civicrm.org/confluence/display/CRMDOC/Example+of+creating+a+payment+processor+extension)
  * [CiviCRM Wiki: Create a payment processor extension](http://wiki.civicrm.org/confluence/display/CRMDOC/Create+a+Payment-Processor+Extension)
  
  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.
  
  **Update**
  
  The payment gateway is [senangPay.my](http://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:
  
  * <https://github.com/username_0/senangPay_CiviCRM>
  
  **Update 2 (implemented answer from username_1 username_1)**
  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>
  
  Thanks!
  
  **Tags:** payment-processor
  
  > **Comments:**
  > **username_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!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-19. Score: 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.
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  