CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Payment Processor redirects for failed or cancelled payments
Pages: [1]

Author Topic: Payment Processor redirects for failed or cancelled payments  (Read 602 times)

joumak

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.6.1
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Payment Processor redirects for failed or cancelled payments
November 13, 2013, 01:28:47 am
I have developed a payment processor for finnish operator Luottokunta (Nets). It works in Notify mode and process is very simple:
1. Generate URL for payment with security hash (MAC) and redirect user to URL. For failures and cancellations URL contains also redirect URLs for them.
2. User enters credit card details and authorizes the transaction in Luottokunta website.
3. Luottokunta redirects user back to CiviCRM with security hash (MAC).

My payment processor handles the transaction (also failures and cancellations), but I'm not sure how I should give feedback to user about problems. There doesn't seem to be similar parameters as _qf_ThankYou_display=1 for cancellations and failures. How should I redirect user to Final URL when there is problem with payment? I have read the documentation & wikis & done some googling & browsing source code for other PPs, but I'm still bit clueless.

Thanks,
Jouni

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Payment Processor redirects for failed or cancelled payments
November 13, 2013, 07:39:41 am

here is the relevant code for paypal ipn:

Code: [Select]
    $url       = ($component == 'event') ? 'civicrm/event/register' : 'civicrm/contribute/transact';
    $cancel    = ($component == 'event') ? '_qf_Register_display' : '_qf_Main_display';
    $returnURL = CRM_Utils_System::url($url,
      "_qf_ThankYou_display=1&qfKey={$params['qfKey']}",
      TRUE, NULL, FALSE
    );

    $cancelUrlString = "$cancel=1&cancel=1&qfKey={$params['qfKey']}";
    if (CRM_Utils_Array::value('is_recur', $params)) {
      $cancelUrlString .= "&isRecur=1&recurId={$params['contributionRecurID']}&contribId={$params['contributionID']}";
    }

note that we send them back the main / register page on cancellation.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

joumak

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.4.1
  • CMS version: WordPress 3.6.1
  • MySQL version: 5.5.31
  • PHP version: 5.3.10
Re: Payment Processor redirects for failed or cancelled payments
November 14, 2013, 10:27:58 am
Thank You. I do the handling similar way, but it would be nice to give user some kind of feedback in message box about cancellation and especially failure.

Btw, I noticed that when user with current membership starts to pay membership fee again, but cancels the transaction, the current membership status is switched to cancelled. Is this by the design or bug?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Payment Processor redirects for failed or cancelled payments

This forum was archived on 2017-11-26.