GFPaymentAddOn
Class GFPaymentAddOn
Used to extend Gravity Forms. Specifically, payment add-ons.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:28
Details
- Kind:
class - Namespace:
(global) - Extends: GFFeedAddOn
Properties
| Property | Type | Description |
|---|---|---|
$_requires_credit_card | bool | True if the payment add-on requires a credit card field. Otherwise, false. |
$_supports_callbacks | bool | True if the add-on supports callbacks. Otherwise, false. |
$authorization | array | Stores authorization results returned from the payment gateway. |
$redirect_url | string | The URL to redirect to. Defaults to empty string. |
$current_feed | array | array | The current Feed Object. Defaults to false. |
$current_submission_data | array | bool | The form submission data. Defaults to false. |
$is_payment_gateway | bool | Set to true if it is a payment gateway add-on. Defaults to false. |
$_single_feed_submission | bool | True if only a single feed should be processed. Otherwise, false. |
$_requires_smallest_unit | bool | True if the smallest unit should be used. Otherwise, will include the decimal places. |
$_supports_feed_reprocessing | bool | Out of the box, payment add-ons do not support feed reprocessing. |
Methods
| Method | Description |
|---|---|
pre_init() | Runs before the payment add-on is initialized. |
init() | Runs when the payment add-on is initialized. |
init_admin() | Runs only when the payment add-on is initialized in the admin. |
init_ajax() | Runs only when AJAX actions are being performed. |
setup() | Runs the setup of the payment add-on. |
post_gravityforms_upgrade() | Gets called when Gravity Forms upgrade process is completed. This function is intended to be used internally, override the upgrade() function to execute database update scripts. |
maybe_delay_feed_processing() | Determines if feed processing is delayed by the payment feed configuration. |
payment_status_changed() | Reprocess feeds and triggers gform_post_payment_status_change hook when the payment status changes. |
trigger_payment_delayed_feeds() | Triggers processing of delayed feeds for other add-ons. |
get_frontend_feeds() | Adds additional relevant information for payment add-ons to the frontend feeds |
get_post_payment_actions_config() | Override to specify where the "Post Payment Action" setting should appear on the payment add-on feed. |
confirmation() | Handles post-submission confirmations. |
redirect_url() | Override this function to specify a URL to the third party payment processor. |
maybe_validate() | Check if the rest of the form has passed validation, is the last page, and that the honeypot field has not been completed. |
maybe_add_payment_status_to_meta() | Handle the entry meta conditional logic confirmations. Adds support for the payment_status entry field to the confirmation condition logic setting. |
get_conditional_logic_payment_statuses() | Returns the payment statuses that can be used in conditional logic. Override this function to add support for payment statuses in conditional logic. |
validation() | Handles the validation and processing of payments. |
is_valid_payment_amount() | Determines if the payment_amount for the current submission is valid for processing. |
authorize() | Override this method to add integration code to the payment processor in order to authorize a credit card with or |
capture() | Override this method to capture a single payment that has been authorized via the authorize() method. |
subscribe() | Override this method to add integration code to the payment processor in order to create a subscription. |
cancel() | Override this method to add integration code to the payment processor in order to cancel a subscription. |
get_validation_result() | Gets the payment validation result. |
maybe_process_feed() | Sets the processed feed meta. |
entry_post_save() | Handles additional processing after an entry is saved. |
process_capture() | Processed the capturing of payments. |
process_subscription() | Processes payment subscriptions. |
insert_transaction() | Inserts a new transaction item. |
get_payment_feed() | Gets the payment submission feed. |
is_payment_gateway() | Determines if this is a payment gateway add-on. |
get_submission_data() | Gets the payment submission data. |
get_credit_card_field() | Gets the credit card field object. |
has_credit_card_field() | Checks if a form has a credit card field. |
get_order_data() | Gets payment order data. |
get_payment_field() | Returns what should be used to prepare the payment amount; the form_total or the ID of a specific product field. |
is_callback_valid() | Checks if the callback should be processed by this payment add-on. |
maybe_process_callback() | Conditionally initiates processing of the callback. |
register_callback() | Registers a callback action. |
is_duplicate_callback() | Checks if a callback is duplicate. |
start_subscription() | Used to start a new subscription. Updates the associcated entry with the payment and transaction details and adds an entry note. |
add_subscription_payment() | A payment on an existing subscription. |
get_entry_by_transaction_id() | Retrieves the ID of the entry associated with the supplied subscription or transaction ID. |
post_payment_action() | Helper for making the gform_post_payment_action hook available to the various payment interaction methods. Also handles sending notifications for payment events. |
reprocess_feeds() | Reprocesses feeds that are configured with Payment Status conditional logic. |
get_feeds_to_reprocess() | Filters out feeds that are not configured with Payment Status conditional logic. |
get_feed_settings_entry_meta() | Returning an empty array because payment feed logic is evaluated before entry meta is saved. |
feed_list_title() | Remove the add new button from the title if the form requires a credit card field. |
get_entry_table_name() | Get name for entry table. |
get_entry_meta_table_name() | Get name for entry meta table. |
get_gravityforms_db_version() | Get version of Gravity Forms database. |
creditcard_token_info() | Override to support creating credit card tokens via Javascript. |
add_creditcard_token_input() | Add input field for credit card token response. |
force_ajax_for_creditcard_tokens() | Enables AJAX for forms that create credit card tokens via Javascript. |
enqueue_creditcard_token_script() | Determines if GFToken script should be enqueued. |
register_creditcard_token_script() | Prepare Javascript for creating credit card tokens. |
get_creditcard_token_entry_fields() | Get needed fields for creating credit card tokens. |
supported_currencies() | Override this function to add or remove currencies from the list of supported currencies |
get_currency() | Retrieve the currency object for the specified currency code. |
get_amount_export() | Format the amount for export to the payment gateway. |
get_amount_import() | If necessary convert the amount back from the smallest unit required by the gateway (e.g cents to dollars). |
maybe_add_action_amount_formatted() | If necessary formats the amount as currency and adds it to the action array. |
entry_deleted() | Target of gform_delete_entry hook. Deletes all transactions and callbacks when an entry is deleted. |
before_delete_field() | Target of gform_before_delete_field hook. Sets relevant payment feeds to inactive when the credit card field is |
entries_filter_count_queries() | Callback for gform_entries_filter_count_queries; registers the db queries to be used to get the entry counts for the filters. |
filter_links_entry_list() | Callback for gform_filter_links_entry_list; registers the filter links to be displayed on the entries list page. |
Method Reference
pre_init()
public function pre_init()
Runs before the payment add-on is initialized.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:189
init()
public function init()
Runs when the payment add-on is initialized.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:214
init_admin()
public function init_admin()
Runs only when the payment add-on is initialized in the admin.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:272
init_ajax()
public function init_ajax()
Runs only when AJAX actions are being performed.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:309
setup()
public function setup()
Runs the setup of the payment add-on.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:329
post_gravityforms_upgrade()
public function post_gravityforms_upgrade( $db_version, $previous_db_version, $force_upgrade )
Gets called when Gravity Forms upgrade process is completed. This function is intended to be used internally, override the upgrade() function to execute database update scripts.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$db_version | Current Gravity Forms database version | ||
$previous_db_version | Previous Gravity Forms database version | ||
$force_upgrade | True if this is a request to force an upgrade. False if this is a standard upgrade (due to version change) |
Source: includes/addon/class-gf-payment-addon.php:425
maybe_delay_feed_processing()
public function maybe_delay_feed_processing( $is_delayed, $form, $entry, $slug )
Determines if feed processing is delayed by the payment feed configuration.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$is_delayed | bool | Is feed processing delayed? | |
$form | array | The form currently being processed. | |
$entry | array | The entry currently being processed. | |
$slug | string | The Add-On slug e.g. gravityformsmailchimp |
Returns
bool
Since: 2.4.13
Source: includes/addon/class-gf-payment-addon.php:455
payment_status_changed()
public function payment_status_changed( $entry_id, $previous_status )
Reprocess feeds and triggers gform_post_payment_status_change hook when the payment status changes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | The entry ID whose payment status has changed. | |
$previous_status | string | The previous payment status. return void |
Since: 2.9.20
Source: includes/addon/class-gf-payment-addon.php:478
trigger_payment_delayed_feeds()
public function trigger_payment_delayed_feeds( $transaction_id, $payment_feed, $entry, $form )
Triggers processing of delayed feeds for other add-ons.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$transaction_id | string | The transaction or subscription ID. | |
$payment_feed | array | The payment feed which originated the transaction. | |
$entry | array | The entry currently being processed. | |
$form | array | The form currently being processed. |
Since: 2.4.13
Source: includes/addon/class-gf-payment-addon.php:517
get_frontend_feeds()
public function get_frontend_feeds( $form )
Adds additional relevant information for payment add-ons to the frontend feeds
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form object to get Frontend Feeds from. |
Returns
array— An array with feeds eligible to be a Front End Feed, including feed data necessary for payment add-ons.
Since: unknown
Source: includes/addon/class-gf-payment-addon.php:544
get_post_payment_actions_config()
public function get_post_payment_actions_config( $feed_slug )
Override to specify where the "Post Payment Action" setting should appear on the payment add-on feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed_slug | string | The feed add-on slug. |
Returns
array
Since: 2.4.13
Source: includes/addon/class-gf-payment-addon.php:599
confirmation()
public function confirmation( $confirmation, $form, $entry, $ajax )
Handles post-submission confirmations.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$confirmation | array | The confirmation details. | |
$form | array | The Form Object that the confirmation is being run for. | |
$entry | array | The Entry Object associated with the submission. | |
$ajax | bool | If the submission was done using AJAX. |
Returns
array— The confirmation details.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:631
redirect_url()
public function redirect_url( $feed, $submission_data, $form, $entry )
Override this function to specify a URL to the third party payment processor.
Useful when developing a payment gateway that processes the payment outside of the website (i.e. PayPal Standard).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | Active payment feed containing all the configuration data. | |
$submission_data | array | Contains form field data submitted by the user as well as payment information (i.e. payment amount, setup fee, line items, etc...). | |
$form | array | Current form array containing all form settings. | |
$entry | array | Current entry array containing entry information (i.e data submitted by users). |
Returns
void|string— Return a full URL (including http:// or https://) to the payment processor.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:659
maybe_validate()
public function maybe_validate( $validation_result, $context='api-submit' )
Check if the rest of the form has passed validation, is the last page, and that the honeypot field has not been completed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$validation_result | array | Contains the validation result, the Form Object, and the failed validation page number. | |
$context | string | 'api-submit' | The context for the current submission. Possible values: form-submit, api-submit, api-validate. |
Returns
array— $validation_result
Since:
Unknown2.6.4(Added the $context param.)
Source: includes/addon/class-gf-payment-addon.php:674
maybe_add_payment_status_to_meta()
public function maybe_add_payment_status_to_meta( $entry_meta, $form, $context='' )
Handle the entry meta conditional logic confirmations. Adds support for the payment_status entry field to the confirmation condition logic setting.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_meta | array | The entry meta. | |
$form | array | The form object. | |
$context | string | '' | The context indicating where the payment statuses will be used. Possible values: confirmation, feed, pre_evaluate. |
Returns
array— Returns the entry meta, with the payment_status field added to it.
Since:
2.9.12.9.19(Added the $context param.)
Source: includes/addon/class-gf-payment-addon.php:704
get_conditional_logic_payment_statuses()
public function get_conditional_logic_payment_statuses( $form )
Returns the payment statuses that can be used in conditional logic. Override this function to add support for payment statuses in conditional logic.
Example: return array( 'Paid' => __( 'Paid', 'gravityforms' ), 'Failed' => __( 'Failed', 'gravityforms' ), 'Processing' => __( 'Processing', 'gravityforms' ), );
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The form object. |
Returns
array— Return an array with the payment statuses that can be used in conditional logic. Return an empty array to disable this feature.
Since: 2.9.19
Source: includes/addon/class-gf-payment-addon.php:757
validation()
public function validation( $validation_result )
Handles the validation and processing of payments.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$validation_result | array | The validation details to use. |
Returns
array— The validation details after completion.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:789
is_valid_payment_amount()
public function is_valid_payment_amount( $submission_data, $feed, $form, $entry )
Determines if the payment_amount for the current submission is valid for processing.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$submission_data | array | The customer and transaction data. | |
$feed | array | The feed to be processed. | |
$form | array | The form being processed. | |
$entry | array | The temporary entry created from the submitted values. |
Returns
bool
Since: 2.4.18
Source: includes/addon/class-gf-payment-addon.php:880
authorize()
public function authorize( $feed, $submission_data, $form, $entry )
Override this method to add integration code to the payment processor in order to authorize a credit card with or
without capturing payment.
This method is executed during the form validation process and allows the form submission process to fail with a validation error if there is anything wrong with the payment/authorization. This method is only supported by single payments. For subscriptions or recurring payments, use the GFPaymentAddOn::subscribe() method.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | Current configured payment feed. | |
$submission_data | array | Contains form field data submitted by the user as well as payment information (i.e. payment amount, setup fee, line items, etc...). | |
$form | array | The Form Object. | |
$entry | array | The Entry Object. NOTE: the entry hasn't been saved to the database at this point, so this $entry object does not have the 'ID' property and is only a memory representation of the entry. |
Returns
array— { Return an $authorization array.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:944
capture()
public function capture( $authorization, $feed, $submission_data, $form, $entry )
Override this method to capture a single payment that has been authorized via the authorize() method.
Use only with single payments. For subscriptions, use subscribe() instead.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$authorization | array | Contains the result of the authorize() function. | |
$feed | array | Current configured payment feed. | |
$submission_data | array | Contains form field data submitted by the user as well as payment information. (i.e. payment amount, setup fee, line items, etc...). | |
$form | array | Current form array containing all form settings. | |
$entry | array | Current entry array containing entry information (i.e data submitted by users). |
Returns
array— { Return an array with the information about the captured payment in the following format:
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:975
subscribe()
public function subscribe( $feed, $submission_data, $form, $entry )
Override this method to add integration code to the payment processor in order to create a subscription.
This method is executed during the form validation process and allows the form submission process to fail with a validation error if there is anything wrong when creating the subscription.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | Current configured payment feed. | |
$submission_data | array | Contains form field data submitted by the user as well as payment information (i.e. payment amount, setup fee, line items, etc...). | |
$form | array | Current form array containing all form settings. | |
$entry | array | Current entry array containing entry information (i.e data submitted by users). NOTE: the entry hasn't been saved to the database at this point, so this $entry object does not have the 'ID' property and is only a memory representation of the entry. |
Returns
array— { Return an $subscription array in the following format:
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1026
cancel()
public function cancel( $entry, $feed )
Override this method to add integration code to the payment processor in order to cancel a subscription.
This method is executed when a subscription is canceled from the Payment Gateway (i.e. Stripe or PayPal).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | Current entry array containing entry information (i.e data submitted by users). | |
$feed | array | Current configured payment feed. |
Returns
bool— Returns true if the subscription was cancelled successfully and false otherwise.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1046
get_validation_result()
public function get_validation_result( $validation_result, $authorization_result )
Gets the payment validation result.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$validation_result | array | Contains the form validation results. | |
$authorization_result | array | Contains the form authorization results. |
Returns
array— The validation result for the credit card field.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1063
maybe_process_feed()
public function maybe_process_feed( $entry, $form )
Sets the processed feed meta.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The Entry Object currently being processed. | |
$form | array | The Form Object currently being processed. |
Returns
array
Since: 2.4.13 (Overrode to prevent processed feed meta being set when a different add-on processed the submission.)
Source: includes/addon/class-gf-payment-addon.php:1092
entry_post_save()
public function entry_post_save( $entry, $form )
Handles additional processing after an entry is saved.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The Entry Object. | |
$form | array | The Form Object. |
Returns
array— The Entry Object.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1122
process_capture()
public function process_capture( $authorization, $feed, $submission_data, $form, $entry )
Processed the capturing of payments.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$authorization | array | The payment authorization details. | |
$feed | array | The Feed Object. | |
$submission_data | array | The form submission data. | |
$form | array | The Form Object. | |
$entry | array | The Entry Object. |
Returns
array— The Entry Object.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1196
process_subscription()
public function process_subscription( $authorization, $feed, $submission_data, $form, $entry )
Processes payment subscriptions.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$authorization | array | The payment authorization details. | |
$feed | array | The Feed Object. | |
$submission_data | array | The form submission data. | |
$form | array | The Form Object. | |
$entry | array | The Entry Object. |
Returns
array— The Entry Object.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1254
insert_transaction()
public function insert_transaction( $entry_id, $transaction_type, $transaction_id, $amount, $is_recurring=null, $subscription_id=null )
Inserts a new transaction item.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | The entry ID that contains the transaction. | |
$transaction_type | string | The transaction type. | |
$transaction_id | string | The ID of the transaction to be inserted. | |
$amount | float | The transaction amount. | |
$is_recurring | int | null | null | If the transaction is recurring. Defaults to null. |
$subscription_id | string | null | null | The subscription ID tied to the transaction, if related to a subscription. Defaults to null. |
Returns
int| WP_Error — The row ID from the database entry. WP_Error if error.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1327
get_payment_feed()
public function get_payment_feed( $entry, $form=false )
Gets the payment submission feed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The Entry Object. | |
$form | bool | array | false | The Form Object. Defaults to false. |
Returns
array— The submission feed.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1383
is_payment_gateway()
public function is_payment_gateway( $entry_id )
Determines if this is a payment gateway add-on.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | int | The entry ID. |
Returns
bool— True if it is a payment gateway. False otherwise.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1422
get_submission_data()
public function get_submission_data( $feed, $form, $entry )
Gets the payment submission data.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The Feed Object. | |
$form | array | The Form Object. | |
$entry | array | The Entry Object. |
Returns
array— The payment submission data.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1457
get_credit_card_field()
public function get_credit_card_field( $form )
Gets the credit card field object.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object. |
Returns
bool| GF_Field_CreditCard — The credit card field object, if found. Otherwise, false.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1521
has_credit_card_field()
public function has_credit_card_field( $form )
Checks if a form has a credit card field.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The Form Object. |
Returns
bool— True if the form has a credit card field. False otherwise.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1540
get_order_data()
public function get_order_data( $feed, $form, $entry )
Gets payment order data.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The Feed Object. | |
$form | array | The Form Object. | |
$entry | array | The Entry Object. |
Returns
array— { The order data.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1567
get_payment_field()
public function get_payment_field( $feed )
Returns what should be used to prepare the payment amount; the form_total or the ID of a specific product field.
Override if your add-on uses custom choices for the transactionType setting or does not use the standard recurringAmount and paymentAmount settings.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feed | array | The current feed. |
Returns
string
Since: 2.4.17
Source: includes/addon/class-gf-payment-addon.php:1684
is_callback_valid()
public function is_callback_valid()
Checks if the callback should be processed by this payment add-on.
Returns
bool— True if valid. False otherwise.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1701
maybe_process_callback()
public function maybe_process_callback()
Conditionally initiates processing of the callback.
Checks to see if the callback is valid, processes callback actions, then returns the appropriate response.
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1730
register_callback()
public function register_callback( $callback_id, $entry_id )
Registers a callback action.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$callback_id | string | The callback ID for the action. | |
$entry_id | int | The entry ID associated with the callback. |
Returns
void
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1961
is_duplicate_callback()
public function is_duplicate_callback( $callback_id )
Checks if a callback is duplicate.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$callback_id | string | The callback ID to chack. |
Returns
bool— If the callback is a duplicate, true. Otherwise, false.
Since: Unknown
Source: includes/addon/class-gf-payment-addon.php:1990
start_subscription()
public function start_subscription( $entry, $subscription )
Used to start a new subscription. Updates the associcated entry with the payment and transaction details and adds an entry note.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | [array] | Entry object | |
$subscription | |||
$subscription_id | [string] | ID of the subscription | |
$amount | [float] | Numeric amount of the initial subscription payment |
Returns
[array]— $entry Entry Object
Source: includes/addon/class-gf-payment-addon.php:2236
add_subscription_payment()
public function add_subscription_payment( $entry, $action )
A payment on an existing subscription.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | [array] | Entry object | |
$action | |||
$data | [array] | Transaction data including 'amount' and 'subscriber_id' |
Returns
true
Source: includes/addon/class-gf-payment-addon.php:2283
get_entry_by_transaction_id()
public function get_entry_by_transaction_id( $transaction_id )
Retrieves the ID of the entry associated with the supplied subscription or transaction ID.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$transaction_id | string | The subscription or transaction ID. |
Returns
bool|string
Since:
2.3.3.9(Updated to search the _gf_addon_payment_transaction table if the ID was not found in the entry table.)unknown
Source: includes/addon/class-gf-payment-addon.php:2475
post_payment_action()
public function post_payment_action( $entry, $action )
Helper for making the gform_post_payment_action hook available to the various payment interaction methods. Also handles sending notifications for payment events.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | ||
$action | array |
Since:
2.3.6.6(Added the $action to the GFAPI::send_notifications() $data param.)unknown
Source: includes/addon/class-gf-payment-addon.php:2504
reprocess_feeds()
public function reprocess_feeds( $entry )
Reprocesses feeds that are configured with Payment Status conditional logic.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry | array | The entry object. | |
$form | array | The form object. |
Since: 2.9.20
Source: includes/addon/class-gf-payment-addon.php:2529
get_feeds_to_reprocess()
public function get_feeds_to_reprocess( $feeds, $entry, $form )
Filters out feeds that are not configured with Payment Status conditional logic.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feeds | array | The feeds to be processed. | |
$entry | array | The entry currently being processed. | |
$form | array | The form currently being processed. |
Returns
array— The filtered feeds that are configured with Payment Status conditional logic.
Since: 2.9.20
Source: includes/addon/class-gf-payment-addon.php:2552
get_feed_settings_entry_meta()
public function get_feed_settings_entry_meta( $form, $entry_meta=[] )
Returning an empty array because payment feed logic is evaluated before entry meta is saved.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | The form the feed is being created or edited for. | |
$entry_meta | array | [] | An empty array or the entry meta fields to be assigned to the JavaScript entry_meta variable. |
Returns
array
Since: 2.9
Source: includes/addon/class-gf-payment-addon.php:2647
feed_list_title()
public function feed_list_title()
Remove the add new button from the title if the form requires a credit card field.
Returns
string
Source: includes/addon/class-gf-payment-addon.php:2656
get_entry_table_name()
public static function get_entry_table_name()
Get name for entry table.
Returns
string
Since: 2.3
Source: includes/addon/class-gf-payment-addon.php:3653
get_entry_meta_table_name()
public static function get_entry_meta_table_name()
Get name for entry meta table.
Returns
string
Since: 2.3
Source: includes/addon/class-gf-payment-addon.php:3671
get_gravityforms_db_version()
public static function get_gravityforms_db_version()
Get version of Gravity Forms database.
Returns
string
Since: 2.3
Source: includes/addon/class-gf-payment-addon.php:3687
creditcard_token_info()
public function creditcard_token_info( $form )
Override to support creating credit card tokens via Javascript.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | mixed |
Returns
array
Source: includes/addon/class-gf-payment-addon.php:3773
add_creditcard_token_input()
public function add_creditcard_token_input( $content, $field, $value, $entry_id, $form_id )
Add input field for credit card token response.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$content | string | ||
$field | GF_Field | ||
$value | string | ||
$entry_id | string | ||
$form_id | string |
Returns
string
Source: includes/addon/class-gf-payment-addon.php:3792
force_ajax_for_creditcard_tokens()
public function force_ajax_for_creditcard_tokens( $args )
Enables AJAX for forms that create credit card tokens via Javascript.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$args | array |
Returns
array
Source: includes/addon/class-gf-payment-addon.php:3819
enqueue_creditcard_token_script()
public function enqueue_creditcard_token_script( $form )
Determines if GFToken script should be enqueued.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array |
Returns
bool
Source: includes/addon/class-gf-payment-addon.php:3838
register_creditcard_token_script()
public function register_creditcard_token_script( $form, $field_values, $is_ajax )
Prepare Javascript for creating credit card tokens.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form | array | ||
$field_values | array | ||
$is_ajax | bool |
Returns
void
Source: includes/addon/class-gf-payment-addon.php:3855
get_creditcard_token_entry_fields()
public function get_creditcard_token_entry_fields( $feeds )
Get needed fields for creating credit card tokens.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$feeds | array |
Returns
array— $fields
Source: includes/addon/class-gf-payment-addon.php:3888
supported_currencies()
public function supported_currencies( $currencies )
Override this function to add or remove currencies from the list of supported currencies
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$currencies | Currently supported currencies |
Returns
mixed— A filtered list of supported currencies
Source: includes/addon/class-gf-payment-addon.php:3910
get_currency()
public function get_currency( $currency_code='' )
Retrieve the currency object for the specified currency code.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$currency_code | string | '' |
Returns
Source: includes/addon/class-gf-payment-addon.php:3921
get_amount_export()
public function get_amount_export( $amount, $currency_code='' )
Format the amount for export to the payment gateway.
Removes currency symbol and if required converts the amount to the smallest unit required by the gateway (e.g. dollars to cents).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$amount | int | float | The value to be formatted. | |
$currency_code | string | '' | The currency code. |
Returns
int|float
Source: includes/addon/class-gf-payment-addon.php:3939
get_amount_import()
public function get_amount_import( $amount, $currency_code='' )
If necessary convert the amount back from the smallest unit required by the gateway (e.g cents to dollars).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$amount | int | float | The value to be formatted. | |
$currency_code | string | '' | The currency code. |
Returns
int|float
Source: includes/addon/class-gf-payment-addon.php:3958
maybe_add_action_amount_formatted()
public function maybe_add_action_amount_formatted( $action, $currency_code='' )
If necessary formats the amount as currency and adds it to the action array.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$action | array | The payment or subscription properties. | |
$currency_code | string | '' | The currency code. |
Returns
array
Since: 2.3.6.6
Source: includes/addon/class-gf-payment-addon.php:3978
entry_deleted()
public function entry_deleted( $entry_id )
Target of gform_delete_entry hook. Deletes all transactions and callbacks when an entry is deleted.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$entry_id | . ID of entry that is being deleted |
Source: includes/addon/class-gf-payment-addon.php:4022
before_delete_field()
public function before_delete_field( $form_id, $field_id )
Target of gform_before_delete_field hook. Sets relevant payment feeds to inactive when the credit card field is
deleted.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$form_id | int | ID of the form being edited. | |
$field_id | int | ID of the field being deleted. |
Source: includes/addon/class-gf-payment-addon.php:4071
entries_filter_count_queries()
public static function entries_filter_count_queries( $queries )
Callback for gform_entries_filter_count_queries; registers the db queries to be used to get the entry counts for the filters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$queries | array | The filter count queries. |
Returns
array
Since: 2.9.16.
Source: includes/addon/class-gf-payment-addon.php:4169
filter_links_entry_list()
public static function filter_links_entry_list( $filter_links, $form, $include_counts, $counts )
Callback for gform_filter_links_entry_list; registers the filter links to be displayed on the entries list page.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$filter_links | array | The filter links to be displayed. | |
$form | array | The form that the entries are being viewed for. | |
$include_counts | bool | Indicates if the entry counts should be included. True for above the entries list table. False for the screen options. | |
$counts | array | The number of entries that match the filters when $include_counts is true. |
Since: 2.9.16
Source: includes/addon/class-gf-payment-addon.php:4198