php - wordpress Gravity forms bank account payment
I am trying to make a page with gravityforms to make a transaction with a bank account payment.
I need to send data to iDevAffiliate database.
The response with the support and google searching has led me to just work with this function
add_action( 'gform_post_payment_completed', my_function, 10, 2 );
i don't understand what is this function my_function that probably i need to make on my own and what are these last two parameters 10 and 2 ?
In some examples i find$entry
and$action
ascotiative arrays that i don't understand how to put data in them.Do they get filled in automatically or i need to fill them in ?
I don't understand anything from the documentation here: https://www.gravityhelp.com/documentation/article/gform_post_payment_completed/
and i found a github example that i don't understand eighter. https://gist.github.com/NikV/7b7ec046df69b1f390bf.
If there is someone that uses these forms or has a working example i would want to see it.Or get a more clear explanation about that function and parameters that i need to pass in.
Answer
Solution:
The add_action call
The
add_action
call is part of Wordpress, not of the gravityforms component, as you can find here.The first parameter contains the function to be called (in your case "gform_post_payment_completed").
The second contains the so-called "callback function", a function that is triggered as soon as the first function has been executed completely.
The third parameter is an internal priority flag for Wordpress
$entry
and$action
) are sent to the initial function.As soon as the call has finished, the callback function is invoked that could i.e. tells a visitor that the payment has been accepted or to redirect him to a download page or whatever your business case is.
The $entry and $action parameters
The
$entry
parameter contains all information about the subscription that is currently handled, themay help you understand more about it and here's the documentation for it.
The
$action
contains information about the currently executed command (i.e. change subscription, execute payment), just search for "$action" on the documentation page for GFPaymentAddon.I haven't used Gravity Forms but I hope you'll find the necessary details on the documentation pages.
Sending part of the data to an external page via curl
As mentioned before, I haven't used the Gravity Forms component and can't test it, but it should work similar to this: