-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the possibility to use Paypal Express Checkout #886
base: 6.x
Are you sure you want to change the base?
Conversation
fd4c695
to
d0be5a6
Compare
@KarinG how do you see this approach |
@rubofvil - thank you for your work on this. I've asked Jitendra to add this to his list. Test failures for 9.5 means the PR will need work. Jitendra can help guide you. |
@rubofvil Do we need to display both paypal button and default webform submit button on the form? The button from paypal redirects to the main webform instead of paypal. Ideally we should be handling the redirect on the paypal button and hide the default submit button if |
I also see a relevent js here - https://github.com/colemanw/webform_civicrm/blob/6.x/js/webform_civicrm_payment.js#L28 which might help in doing the above? @rubofvil |
Thanks, @jitendrapurohit You are right with this, the CiviCRM contribution / event page works with this extra button added with javascript. We are doing the integration with more payment processors and we prefer, if is possible, work with normal submit (with the usual submit button), not with an extra button that paypal express generate. Can we work to disable this javascript that generates the paypal express button?
|
I haven't used paypal express for any of our client. Do you think its a normal approach of making a payment? Since paypal express provides this button, i would expect to click on the same button to redirect me to paypal site for payment, and not the normal site submit button to do so. Would like to have more thoughts on this from admins using this processor. Anyone @KarinG ? @rubofvil From the js code I pasted the link above, i think submit would still work, the section of the code still uses the d7 element ids, etc. Perhaps making a change like the following would allow you to redirect to paypal with the express button? diff --git a/js/webform_civicrm_payment.js b/js/webform_civicrm_payment.js
index 0adf0e9..6aec469 100644
--- a/js/webform_civicrm_payment.js
+++ b/js/webform_civicrm_payment.js
@@ -26,12 +26,12 @@
});
}
// When an express payment button is clicked, skip the billing fields and submit the form with a placeholder
- var $expressButton = $billingPaymentBlock.find('input[name$=_upload_express]');
+ var $expressButton = $billingPaymentBlock.find('button[name$=_upload_express]');
if ($expressButton.length) {
$expressButton.removeClass('crm-form-submit').click(function(e) {
e.preventDefault();
$billingPaymentBlock.find('input[name=credit_card_number]').val('express');
- $(this).closest('form').find('input.webform-submit.button-primary').click();
+ $(this).closest('form').find('input.webform-button--submit.form-submit').click();
})
}
$('fieldset.billing_name_address-group').remove();
|
Thx @KarinG @jitendrapurohit for the feedback, this week i don't have time, next week i will provide a more generic solution with default paypal express button and hidding the default submit button |
Thx for feeback @KarinG @jitendrapurohit Issue with Paypal ButtonI adjust the code with the advices of @jitendrapurohit, to work with usual workflow, the same that is use by CiviCRM in contribution page, hiding the submit button and only showing the Paypal button. Issue with confirmation pageTo this point this dev is only working with the default confirmation page of the webform (showed in the screenshot). A proposal would be to work in a "preview confirmation page", like in CiviCRM contribution page workflow, and after that redirect to the confirmation page selected in the settings of the webform. Screenshot of the previous page in CiviCRM that confirms the contribution to Paypal@KarinG @jitendrapurohit what do you think about this proposal? Video - All workflow in CiviCRM contribution page |
Thanks for the update @rubofvil. On a quick review, it looks like both buttons (submit & paypal) is still displayed when the webform has payment processor configured as only paypal express. It works fine when payment processor is set to Also, would it be possible to add style to the paypal button? See the relevant code in civi - https://github.com/civicrm/civicrm-core/blob/master/CRM/Core/Payment/PayPalImpl.php#L187-L197 |
Overview
Add the possibility to use PayPal Express Checkout
Before
Don't begin the process.
After
Work, the contribution is completed and the redirect is succeeding.
Comments