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

Jon W

Well-known member
Affected version
2.0.10
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.
 
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.
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.0 B7/RC1).

Change log:
Adjust PayPal's allowed recurring payment intervals to match their documented limits, support weekly intervals.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
Top Bottom