webform_civicrm
webform_civicrm copied to clipboard
D8/9 - Add test for stripe recur payment
Overview
Add test for stripe recur payment
Before
No test.
After
Test Added. But it fails and seems to be a bug (not sure in wc or in stripe). The error is:
To replicate
- Create a webform with recur enabled (Frequency = month).
- Submit the webform.
- Error.
@mattwire Any quick thoughts on why is it failing?
@jitendrapurohit Can you check the configuration of the webform per https://docs.civicrm.org/stripe/en/latest/integration/#recurring-payments
The test here does not enable Number of installments
on the webform. Not having this field should also be able to start monthly recur payments on a contact? @mattwire
@jitendrapurohit You must have one of "Number of installments" or "Interval of installments" on the form. This is because we must be able to detect if the webform is submitting a recurring payment using javascript: https://lab.civicrm.org/extensions/mjwshared/-/blob/master/js/crm.payment.js#L175-181
It would be really nice to find a better way to detect this but currently this is the only way I could find.
Use number of installments = 0
Anything other than number of installments = 1
will ensure WFC creates a recurring series. number of installments = 0
means open ended recurring.
@KarinG With installment = 0 or anything else (not 1) returns the same error. I think this is what Matt means when he says you "must" have installment field while taking recur payments through the webforms. Am i correct @mattwire. If yes, do you intend to support unending stripe recur payments via webform in the future?
@mattwire - I just added to this test -> https://github.com/colemanw/webform_civicrm/pull/717 - it now demonstrates WFC with iATS Payments for both instalments = 12 as well as instalments = 0 (which creates an open ended recurring series).
I think this is then waiting on you to make edits in Stripe? If/when you do - we have the test ready to go - to lock it in.
Stripe does support open ended recurring payments. But it needs to be able to detect this directly on the form using jquery/javascript. On drupal 7 that means you cannot use a hidden field (for installments) in "secure value" mode. I don't have a drupal 9 site to test with right now. If you run CRM.payment.getIsRecur()
in the browser console it will tell you if it's detected or not.
Installments is not hidden here - so not sure why Stripe is not detecting that we’re trying to create a recurring series?