Getting error when go to pay at Papal

Getting this error when you click the subscribe button and go to paypal.

"First trial period missing. You must specify first trial period if you want to specify second trial period."

The sub plan for it is set up as

level 1
finite
7 days
$597

level 2
finite
7 days
$0

level 3
finite
7 days
$0

level 4
finite
7 days
$0

level 5
finite
7 days
$0

level 6
finite
7 days
$0

Which I think is all correct as I have another sub plan which is set up the same with different price and its working perfectly.

The only issue I can think that caused it was that the working one was made prior to sandbox being activated as a test gateway and then when I realised I'd activated it I then activated the live paypal and re made the non working sub plans however they are giving the above error. I know sandbox has caused other issue sin the past and I'm wondering how I can remedy this...

I feel so close to completing this project but there always seems to be just one more lil hiccup with this plugin... :slight_smile:

I have updated to the latest version of membership plugin as well as wordpress.

Thanks in advance
Em

  • Alexander
    • DEV MAN’s Mascot

    Hey there @embod,

    I can help you troubleshoot this. Thanks for confirming you're up to date with the latest versions.

    So which version of the PayPal gateway are you using? I've tested this, and it works fine with the single Payments gateway. I did get a similar error message with the PayPal Express gateway, but I believe that's because with that gateway it tries to set this up as a recurring payment, and sees zero as a trial period. Mine said "Invalid second trial period. You must specify valid values for the A2, P2, and T2 parameters for a subscription."

    To be honest I'm not 100% sure, can you try the single payments gateway? If that doesn't work I might need to get in touch with the plugin developer.

    Thanks for being a WPMU DEV member. Let us know if we can be of any further assistance.
    Best regards,

  • embod
    • Design Lord, Child of Thor

    Hi,

    Sorry I should have mentioned that.

    Yes it does work with the single payments gateway.

    However I have express active as I am offering a payment plan as well.

    Setup as

    level 1
    finite
    7 days
    $200

    level 2
    finite
    7 days
    $0

    level 3
    finite
    7 days
    $200

    level 4
    finite
    7 days
    $0

    level 5
    finite
    7 days
    $200

    level 6
    finite
    7 days
    $0

    I don't want to have both active as the 2 buttons are very confusing to people.

    What's bugging me is I had this all set up and working perfectly and now only one works.

    It also bugs me that one is working and the other is not....

    Could sandbox have caused some kind of break....

    I just don't know where to start to remedy it. The site is now all done so I really don't want to have to do a fresh install of wordpress, which is what fixed issues with this plugin in the past.

    Thanks
    Em

  • embod
    • Design Lord, Child of Thor

    Just a quick update on the 3 payment one as I am playing around trying to fix this...

    Original setup that I want it to work as
    level 1
    finite
    7 days
    $200

    level 2
    finite
    7 days
    $0

    level 3
    finite
    7 days
    $200

    level 4
    finite
    7 days
    $0

    level 5
    finite
    7 days
    $200

    level 6
    finite
    7 days
    $0

    gives this error
    Invalid second trial period. You must specify valid values for the A2, P2 and T2 parameters for a subscription.

    when I change the second level to
    level 2
    finite
    7 days
    $1

    it works!

    Everything else is exactly the same....

    Even though there is another $0 level further down.

    I think the subscription plan area is just stuffed in this install.... how would I go about just replacing that element? Eg what areas in the database would I have to clear or delete... Is this possible?

  • embod
    • Design Lord, Child of Thor

    What has fixed issues in the past with membership plugin is removing certain tables from the database.

    How would I go about making a clean slate for the subscription plan and payment gateway areas as these seem to be causing the problem?

    I think it would be using these areas

    wp_m_subscriptionmeta
    wp_m_subscriptions
    wp_m_subscriptions_levels
    wp_m_subscription_transaction

    How would I go about this without removing the plugin completely - which I'd hate to do as soooo much work has gone into it now.

  • Alexander
    • DEV MAN’s Mascot

    Hey @embod,

    I doubt a fresh install of Wordpress is going to help here, as I've gotten a similar error message testing this. However, I think this is more a case that what you're trying to do isn't compatible with the express gateway - as it sees the $0 and attempts to create as a trial. This gives the error.

    I think the issue with it working in Sandbox could just be that the sandbox API is less strict, or something could be preventing it from giving the error message.

    Ideally, if you need both "one time payment" plan, and subscription plans, you would have both gateways open. But I do see where that brings up an issue with the multiple buttons.

    I'm going to get in touch with the developer to see if he has any suggestions or feedback on this, as I'm not 100% sure that I understand what the errors mean.

  • embod
    • Design Lord, Child of Thor

    I have another client site where this exact thing is implemented and it works fine in live mode with paypal express. I have both one time and plans set up... I'll see if I can reput the code somewhere as the sales period has ended for it.

  • embod
    • Design Lord, Child of Thor

    Again, these are all correct and my settings are within those parameters. I think something is going awry in what it actually sends off to Paypal. Eg there has been a corruption or something. Is there any way to visually see what the request it is sending off to paypal is.

    Cheers
    Em

  • Barry
    • DEV MAN’s Mascot

    You have to think when setting up for PayPal express as PayPal can only handle certain scenarios.

    E.g.
    Paid period
    Free period - paid period
    Paid period - paid period
    Free period - paid period - paid period
    Paid period - paid period - paid period

    To a maximum of three periods. The last one can be a serial period and so repeats.

  • embod
    • Design Lord, Child of Thor

    HI Barry ,

    Sorry bit confused...

    Are you saying Paypal express can only handle three levels all up?

    Or three paid levels?

    Can I make this sub plan work?
    level 1
    finite
    7 days
    $200

    level 2
    finite
    7 days
    $0

    level 3
    finite
    7 days
    $200

    level 4
    finite
    7 days
    $0

    level 5
    finite
    7 days
    $200

    level 6
    finite
    7 days
    $0

    Also why would 1 of my sub plans thats
    level 1
    finite
    $297

    then 5 more free levels work

    and one set up exactly the same but different price not work?

    Em

  • Alexander
    • DEV MAN’s Mascot

    Ok, marking this as resolved. But just to clarify as we discussed in chat, this is possible but requires the single payments gateway instead of the Express.

    The problem presented here is that when you want to have plans that are one time payments, and plans that are subscriptions, both gateways will appear if they are both enabled. There isn't a way to specify a gateway to be used with a subscription plan, or to prohibit a subscription from using a gateway.

    Best regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.