pro sites payment bugs with Stripe

This is super confusing.

2016-12-14 4:42:59 pm Stripe webhook "customer.subscription.updated" received. The customer's subscription was successfully updated to cre8tives Essential: $15.00 every 3 months.

The Subscription Has Been Cancelled in Stripe
They should continue to have access until March 14, 2017.

2016-12-14 5:44:13 pm Payment failed email sent to

Payment failed. Payment received. Subscription cancelled. Subscription renewed. It's a mess. Unless Pro Sites is the Schrodinger's Cat of payment systems. As long as you don't look in the box, the subscription is both active and cancelled at the same time!

Site Access enabled. Blog ID: 129. Need answers about this... paying too much money for these plugins to have such chaos IMHO.

  • Dimitris

    Hey there peter_harris,

    hope you're doing good and thanks for reaching us! :slight_smile:

    It seems that the payment email failed to sent to your customer at 2016-12-14.
    Then there was another try 3 days later (2016-12-14), and another one 5 days after the previous one(2016-12-22). Both failed again.
    The final try was 15 days after the initial date, this failure resulted the subscription to be cancelled.

    Could you please double check that this is true via your Stripe dashboard?
    Just replace "CUSTOMER_ID" with the customer ID string found in edit Pro Site admin screen.
    https://dashboard.stripe.com/customers/CUSTOMER_ID

    2016-12-29 5:45:01 pm Stripe webhook "customer.subscription.deleted" received: The subscription has been canceled

    2016-12-22 5:44:18 pm Payment failed email sent to **********@ymail.com
    2016-12-22 5:44:11 pm Stripe webhook "invoice.updated" received: Customer ID: cus_xxxxxxxxxxxxxx

    2016-12-17 5:44:10 pm Stripe webhook "invoice.updated" received: Customer ID: cus_xxxxxxxxxxxxxx
    2016-12-17 5:44:08 pm Payment failed email sent to **********@ymail.com

    2016-12-14 5:44:14 pm Stripe webhook "invoice.updated" received: Customer ID: cus_xxxxxxxxxxxxxx
    2016-12-14 5:44:13 pm Payment failed email sent to **********@ymail.com
    2016-12-14 5:44:09 pm Stripe webhook "customer.subscription.updated" received. The customer's subscription was successfully updated to cre8tives Essential: $15.00 every 3 months.
    2016-12-14 4:43:02 pm Stripe webhook "invoice.created" received: Customer ID: cus_xxxxxxxxxxxxxx
    2016-12-14 4:42:59 pm Stripe webhook "customer.subscription.updated" received. The customer's subscription was successfully updated to cre8tives Essential: $15.00 every 3 months.

    Warm regards,
    Dimitris

  • peter_harris

    Noticed another site with completing conflicting information:
    wp-admin/network/admin.php?page=psts&bid=145

    * Pro Site privileges will expire on: January 12, 2018
    * Last Payment Date: January 12, 2017
    * Next Payment Date: January 23, 2017
    * 2017-01-18 7:23:08 pm Payment failed email sent to __@__.com

    WHAT??
    Billing took place on the 12th, the subscription was renewed and yet it keeps sending out emails saying the payment failed and is going to renew again on the 27th??

    This is getting really distressing.

  • Dimitris

    Hey there peter_harris,

    please excuse my late reply here, it's been unusually busy in our forums lately and we try to keep up with every single member and topic in our forums!

    Could this have anything to do with recently updating the webhook? Had discovered that the S was missing in httpS.

    This webhook URL is used in order for Stripe to inform Pro Sites about anything regarding member's payments and subscriptions so if this wasn't working in the past it should be an issue.

    Could you please send us some server details in order to forward this to our Second Level Support guys? As this is public forum, you should send us your details through our safe contact form https://premium.wpmudev.org/contact/#i-have-a-different-question using this template:

    Subject: "Attn: Dimitris"
    - WordPress admin (login url/username/password)
    - FTP credentials (host/username/password)
    - cPanel/Plesk credentials (host/username/password)
    - link back to this thread for reference
    - any other relevant urls

    Keep in mind the subject line as ensures that it gets assigned to me.

    Warm regards,
    Dimitris

  • Dimitris

    Hey there peter_harris,

    hope you're doing good today! :slight_smile:

    I already pinged our SLS team to provide some feedback on this. Please keep in mind that their response times are a bit larger than ours here in support forums so your patience is highly appreciated here! Me or another colleague of mine will let you know as soon as we've got any valuable feedback from them.

    Take care,
    Dimitris

  • Lindeni Mahlalela

    Hello peter_ahrris,

    I hope you are having a great day so far and I am really sorry for the late reply with regards to this issue.

    I am here to help you resolve this issue, but before I can help I would like to know if you still need help or you got this resolved by other means. If you are still experiencing this issue please reply and grant access to your website admin again. Also confirm if the other access credentials we have are still active or not, if you have changed them we would appreciate if you send in the updated credentials.

    If you have changed any of the login credentials, please resend them via our secure contact form as follows:

    Subject: "Attn: Lindeni Mahlalela"
    - WordPress admin (login url/username/password)
    - FTP credentials (host/username/password)
    - cPanel/Plesk credentials (host/username/password)
    - link back to this thread for reference
    - any other relevant urls

    Also grant staff access to your wordpress admin, you may follow this guide https://premium.wpmudev.org/manuals/wpmu-dev-dashboard-enabling-staff-login/ if you have forgotten how to.

    Once you have confirmed, granted access to your site and sent the access credentials I will get right to this and I hope we will solve it as soon as possible.

    Thank you for your patience as we solve this issue and we are really sorry for the delay.

    I hope you enjoy your day further.

    Cheers,
    Mahlamusa

  • peter_harris

    No, the problems remain. In fact, the same thing happened again. Four failed payment attempts appear in my stripe account for Blog ID: 88 and yet Pro Sites shows the site both renewed and canceled:

    The Subscription Has Been Cancelled in Stripe
    They should continue to have access until April 1, 2018.

    Site access shouldn't have changed, but if you have any troubles, let me know. Dashboard Support access enabled.

  • Lindeni Mahlalela

    Hello peter_harris,

    I hope you are having a great day so far.

    I have looked into the issue and found the reason why this is happening. It is mainly because of how Stripe works, the flow in stripe is as follows when a subscription period ends:

    1. Stripe updates subscription and send web hook to your website saying "customer.subscription.updated". This tells Pro Sites to extend access for the blog, so Pro Sites activates the blog for another month/year depending on your billing options

    2. Stripe creates invoice in its system and send another hook saying "invoice.created" and then another "customer.subscription.updated" for the updated invoice.

    3. Stripe tries to charge the customer for the invoice. If payment fails it sends a webhook saying "invoice.payment_failed". If payment fails, Stripe will retry several times sending the payment_failed webhook.

    4. If payment was never received for the invoice, Stripe sends a "customer.subscription.deleted" webhook, which by default tells Pro Sites to FLAG the blog for cancellation but does not actually cancel the blog.

    Pro Sites as it currently is will only flag the blog for cancellation if the subscription was cancelled by the payment gateway, this will keep the website active for the remainder of the subscription period.

    This behavior can be overridden by running the Stripe's
    widthraw($blog_id);
    function when the 'customer.subscription.deleted' webhook is received. This will immediately remove the site's Pro status. You can achieve this by editing the file "/plugins/pro-sites/pro-sites-files/gateways/gateway-stripe.php', as follows:

    find the line
    case 'customer.subscription.deleted' :

    and add the lines:

    update_blog_option( $blog_id, 'psts_is_canceled', 1 );
    $psts->withdraw( $blog_id );

    before or after the line:
    update_blog_option( $blog_id, 'psts_stripe_canceled', 1 );

    so you will have something like this :

    case 'customer.subscription.deleted' :
    						update_blog_option( $blog_id, 'psts_stripe_canceled', 1 );
    					update_blog_option( $blog_id, 'psts_is_canceled', 1 );
    						$psts->withdraw( $blog_id );
    						$psts->log_action( $blog_id, sprintf( __( 'Stripe webhook "%s" received: The subscription has been canceled', 'psts' ), $event_type ) );
    						break;

    Doing this modification will ensure that the blog/website gets canceled in Pro Sites if the subscription was canceled on Stripe due to failed payment.

    With regards to the blogs that are currently active while they should be canceled, you can manually cancel those for now. After that all subscriptions canceled through Stripe will result in their respective blogs being cancelled on your network too.

    I have applied this fix to your website so it should be fine for now. But please note that this is not a final update and so is not yet merged for release in the next update and so it may be overwritten by future updates.

    I hope this resolves the issue at hand but if you need more help with regards to this, then let us know and we will gladly assist you in anyway possible. Also let me know if this fix causes any issues on your website.

    I hope you enjoy your day further.

    Cheers,
    Mahlamusa