# give/4.15.4/src/Framework/PaymentGateways/Actions/GenerateGatewayRouteUrl.php

GiveWP – Donation Plugin and Fundraising Platform, version 4.15.4. 35 lines.

- Page: https://pluginprobe.com/plugins/give/4.15.4/code/src/Framework/PaymentGateways/Actions/GenerateGatewayRouteUrl.php
- Raw: https://pluginprobe.com/plugins/give/4.15.4/raw/src/Framework/PaymentGateways/Actions/GenerateGatewayRouteUrl.php
- Modified: 2022-06-17T00:03:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/give/4.15.4/code/src/Framework/PaymentGateways/Actions/GenerateGatewayRouteUrl.php#L10-L20`.

```php
<?php

namespace Give\Framework\PaymentGateways\Actions;

class GenerateGatewayRouteUrl
{
    /**
     * @param  string  $gatewayId
     * @param  string  $gatewayMethod
     * @param  array|null  $args
     * @return string
     * @since 2.18.0
     *
     * @since 2.19.0 remove $donationId param in favor of args
     *
     */
    public function __invoke(string $gatewayId, string $gatewayMethod, array $args = []): string
    {
        $queryArgs = [
            'give-listener' => 'give-gateway',
            'give-gateway-id' => $gatewayId,
            'give-gateway-method' => $gatewayMethod,
        ];

        if ($args) {
            $queryArgs = array_merge($queryArgs, $args);
        }

        return esc_url_raw(add_query_arg(
            $queryArgs,
            home_url()
        ));
    }
}

```
