Invalid Regular period. You must specify valid values for the A3, P3 and T3 parameters for a subscription.

Affected version
2.0.10

Jon W

Well-known member
Allowing recurring payments for days > 90 and < 365 produces the following error on PayPal:
Invalid Regular period. You must specify valid values for the A3, P3 and T3 parameters for a subscription.
There doesn't seem to be a supportsRecurring method for PayPal, but it should allow for the following:
PHP:
            case 'day':
                if ($amount <= 90)
                {
                    $supported = true;
                }
                break;
            case 'week':
                if ($amount <= 52)
                {
                    $supported = true;
                }
                break;
            case 'month':
                if ($amount <= 24)
                {
                    $supported = true;
                }
                break;
            case 'year':
                if ($amount <= 5)
                {
                    $supported = true;
                }
                break;
Also, "week" is listed in the abstract supportsRecurring method as supported, and that is inherited by the PayPal provider, but the PayPal provider class actually doesn't support it at present even though PayPal does. So I get the same error as above on PayPal when I try to build my own Purchase type that does allow weeks.

I think this could easily be fixed by replacing:
PHP:
            switch ($purchase->lengthUnit)
            {
                case 'day': $params['t3'] = 'D'; break;
                case 'month': $params['t3'] = 'M'; break;
                case 'year': $params['t3'] = 'Y'; break;
                default: $params['t3'] = ''; break;
            }
with:
PHP:
            switch ($purchase->lengthUnit)
            {
                case 'day': $params['t3'] = 'D'; break;
                case 'week': $params['t3'] = 'W'; break;
                case 'month': $params['t3'] = 'M'; break;
                case 'year': $params['t3'] = 'Y'; break;
                default: $params['t3'] = ''; break;
            }
in the getPaymentParams method.

Are these things that can be fixed in a future version of XF2 or whether I just need to fix them in my add-on?

FWIW, what you currently have is still a vast improvement on XF1!!

Thanks.
 

Jon W

Well-known member
Just noticed that the xf_user_upgrade table doesn't allow for week in the length_unit column, which I assume is the reason you don't support it. It would still be great if you could support it in the PayPal provider class though, even if you don't support it for User Upgrades.
 
Top