zaus / forms-3rdparty-integration

Wordpress Plugin - Forms 3rdparty Integration - a plugin to help integrate 3rdparty services with common WP Forms plugins like Contact Form 7 and Gravity Forms
http://wordpress.org/plugins/forms-3rdparty-integration/
47 stars 14 forks source link

Redirect to payment gateway not working using CF7 + 3rd #45

Closed shirani182 closed 9 years ago

shirani182 commented 9 years ago

I'm trying to get the post action to actually redirect the client to a payment gateway once they click submit on my form. I configured some hidden field on the CF7 and mapped filed using the 3rd party plugin, and i need these field values to be posted to the payment URL so the payment page successfully works.

I turned on the debug mode and I don't get any error in response (attached bellow). And despite this it is not redirect the page to the url set in "submission url"

Do I need to add hook? witch on?

Thanks Shiran.

* Service * Array ( [name] => Tranzila [url] => https://direct.tranzila.com/ttxbpracti/ [forms] => Array ( [0] => cf7_13181 )

[success] =>
[failure] =>
[timeout] => 10
[mapping] => Array
    (
        [0] => Array
            (
                [lbl] =>
                [src] => your-name
                [3rd] => contact
            )

        [1] => Array
            (
                [lbl] =>
                [src] => your-email
                [3rd] => email
            )

        [2] => Array
            (
                [lbl] =>
                [src] => your-subject
                [3rd] => phone
            )

    )

[separator] => ,

)

* Post (Form) * http://www.bpracti.co.il/?page_id=12946&preview=true&preview_id=12946&preview_nonce=592cd3e314 Array ( [_wpcf7] => 13181 [_wpcf7_version] => 4.2.1 [_wpcf7_locale] => he_IL [_wpcf7_unit_tag] => wpcf7-f13181-p12946-o1 [_wpnonce] => da77a495e4 [your-name] => sss [your-subject] => sss [your-email] => sss@ss.com [TranzilaToken] => some=value&andother=fdds [sum] => 15 [_wpcf7_is_ajax_call] => 1 )

* Post (to Service) * Array ( [timeout] => 10 [body] => Array ( [contact] => sss [email] => sss@ss.com [phone] => sss )

)

* Response * Array ( [headers] => Array ( [date] => Tue, 28 Jul 2015 16:52:07 GMT [server] => Apache [x-xss-protection] => 0 [p3p] => CP="HONK IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT" [set-cookie] => PHPSESSID=muk15j6pephbnh4ghukv326237; path=/; domain=direct.tranzila.com; secure [expires] => Thu, 19 Nov 1981 08:52:00 GMT [cache-control] => no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [pragma] => no-cache [vary] => Accept-Encoding [content-encoding] => gzip [content-length] => 5129 [connection] => close [content-type] => text/html; charset=UTF-8 )

[body] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Bpracti סדנאות פרקטיקה - טרנזילה שירותי סליקה באינטרנט ```

  • סה"כ ₪



```

Checkout with PayPal - CheckOut with PayPal Tranzila

  • /
  • סה"כ לתשלום

    שלם באמצעות כרטיס אשראי
```
Logo

Bpracti סדנאות פרקטיקה

PCI DSS
```

[response] => Array ( [code] => 200 [message] => OK )

[cookies] => Array ( [0] => WP_Http_Cookie Object ( [name] => PHPSESSID [value] => muk15j6pephbnh4ghukv326237 [expires] => [path] => / [domain] => direct.tranzila.com [secure] => )

)

[filename] =>



)
zaus commented 9 years ago

See my reply in WP forum https://wordpress.org/support/topic/redirect-to-payment-gateway-not-working-using-cf7-3rd-4?replies=2#post-7298438

I just recently completed a redirect with CF7, it's a little weird but not too complicated. You basically need two hooks:

  1. one to preprocess the mapped fields and turn them into your redirect url (and bypass the regular sending since you don't want to post to the service, just redirect) -- see #5 of https://github.com/zaus/forms-3rdparty-integration#hooks
  2. one to attach that redirect url to the CF7 instance, which you can within the hook ..._remote_success using something like
    $addl = $form->prop('additional_settings');
    $addl .= "\non_sent_ok: \"(function(){ location = {$this->redirect}})();\"";

    $form->set_properties(array('additional_settings'=>$addl));
zaus commented 9 years ago

Closing -- not an issue with the plugin, and not something that I'd want to add to core. Useful as an "add-on" plugin.