gform_paypal_return_url

Description

Use this filter to modify the return URL, which is the URL that users will be sent to after completing the payment on PayPal’s site. Useful when the return URL isn’t created correctly (could happen on some server configurations using PROXY servers).

Usage

add_filter( 'gform_paypal_return_url', 'your_function_name', 10, 4 ) ;

Parameters

  • $url string

    The return URL, uses the $_SERVER[‘SERVER_NAME’] parameter.

  • $form_id integer

    The ID of the form being processed.

  • $entry_id integer

    The ID of the entry being processed.

  • $query string

    The gf_paypal_return parameter and value.

Examples

1. Use site_url()

This example shows how you can replace the default return URL with the url returned by the WordPress site_url function.

add_filter( 'gform_paypal_return_url', 'update_url', 10, 4 );
function update_url( $url, $form_id, $entry_id, $query ) {

    return trailingslashit( site_url() ) . '?' . $query;
}

2. Hardcoded URL

This example shows how you can replace the default return URL with a hardcoded url

add_filter( 'gform_paypal_return_url', 'update_url', 10, 4 );
function update_url( $url, $form_id, $entry_id, $query ) {

    return 'https://somedomain.com/?' . $query;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

apply_filters( 'gform_paypal_return_url', $url, $form_id, $lead_id, $query )

This filter is located in GFPayPal::return_url() in class-gf-paypal.php.