gform_ppcp_enable_funding

Description

When using the PayPal Checkout method, this filter can be used to add a funding source to the permitted list of sources for a form using the PayPal Field.

For this filter to work, the Display Other Payment Buttons setting must be enabled on the PayPal field settings.

Note that including a payment method on the permitted list does not guarantee that it will be offered to your customers. That process is handled by PayPal directly when they present the payment dialog. Refer to this document for further information on adding other payment buttons to a PayPal Checkout enabled form.

Usage

The following would apply to all forms:

add_filter( 'gform_ppcp_enable_funding', function( $sources ) {
     $sources[ 'source_id' ] = 'Source Name';
     return $sources;
});

Parameters

An array of funding sources to be added to the permitted list.

Default Funding Sources

The add-on enables the following funding sources by default (current as of v2.7.0 – 2023-08-31):

$enabled_funding = array(
    'card'     => 'Card',
    'credit'   => 'Credit',
    'paylater' => 'Pay Later',
    'sepa'     => 'SEPA',
    'ideal'    => 'Ideal',
    'venmo'    => 'Venmo',
);

You do not need this filter to enable these default funding sources. See the PayPal Checkout developer documentation for the latest updates to the available funding sources.

Examples

Add Giropay as a Funding Source

This example shows how you can add a potential new funding source. PayPal has the final word to determine which funding sources are shown for each visitor in any case.

add_filter( 'gform_ppcp_enable_funding', function( $sources ) {
     $sources[ 'giropay' ] = 'Giropay';
     return $sources;
 });

Note: if you receive a header overflow error in the PayPal modal when using this filter, you will need to reduce the number of potential funding sources allowed by the add-on, using the gform_ppcp_disable_funding filter.

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

implode( ',', apply_filters( 'gform_ppcp_enable_funding', $enabled_funding ) );

This hook is located in GF_PPCP::get_enabled_funding_sources() in class-gf-ppcp.php.

Since

PayPal Checkout Add-On version 2.3.3.