Skip to content
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

Gravity Forms empty amount (0) » No payment » Action gform_ideal_fulfillment hook #28

Open
remcotolsma opened this issue Aug 31, 2021 · 2 comments

Comments

@remcotolsma
Copy link
Member

remcotolsma commented Aug 31, 2021

As mentioned in pronamic/wp-pronamic-pay#188 (comment) Gravity Forms does not handle empty payment amounts (0) by default:

I checked how Gravity Forms handles an empty amount (0) by default:
https://github.com/wp-premium/gravityforms/blob/2.4.20/includes/addon/class-gf-payment-addon.php#L663-L700

By default a payment amount is valid when the amount is greater than zero. Currently we bypass this check and also start a payment for an empty amount (0). For a creditcard subscription payment via Mollie this is desired.

It is possible to initiate a payment via conditional logic only if the amount is greater than 0. However, for this you need to add a hidden number field with a calculation that can be used within the conditional logic.

Schermafbeelding 2021-08-27 om 15 54 18 Schermafbeelding 2021-08-27 om 15 53 40

We could advice users to setup their forms this way if they don't want to trigger the payment feed for payments of € 0.

But this change will likely result in some support tickets.

In Pronamic Pay we have created payments with a 0 amount that were automatically marked as successful. This allowed developers to use the gform_ideal_fulfillment action hook for Gravity Forms entries with amount (> 0), but also for entries without amount (= 0). We will probably change this in the future. Developers using gform_ideal_fulfillment action hook may need to take action. In this issue we can discuss possible future-proof solutions. Some preparations have already been made:

@deprecated Fulfillment of payments without amount (free) will be removed in the future. Use `gform_post_payment_completed` action instead.

The gform_post_payment_completed action will probably not run for entries with an empty amount.

Developers could use the gform_post_payment_completed action for entries where amount > 0 and gform_entry_created for entries where amount = 0.

Perhaps the best solution is to develop a https://docs.gravityforms.com/gffeedaddon/ which executes the code from the gform_ideal_fulfillment action.

@remcotolsma
Copy link
Member Author

On https://github.com/gravityforms/simplefeedaddon is very simple example of a feed-based add-on for Gravity Forms. The advantage of a feed-based Gravity Forms add-on is that they can be automatically delayed until after a successful payment. If there is no payment (amount = 0) then the feed will be executed immediately.

@rvdsteege
Copy link
Member

Perhaps the best solution is to develop a https://docs.gravityforms.com/gffeedaddon/ which executes the code from the gform_ideal_fulfillment action.

To clarify, if the add-on has support for delayed payment integration, the action will show up in our Delayed actions settings in the payment feed settings automatically.

@remcotolsma remcotolsma transferred this issue from pronamic/wp-pronamic-pay Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

2 participants