Forum Replies Created

Viewing 15 replies - 1 through 15 (of 24 total)
  • Thread Starter crackajax

    (@crackajax)

    To be clear, it is not just a generic appendage of “wp_” to the old _stripe_customer_id key, but it is actually an appendage of the database prefix to the old key.

    Thread Starter crackajax

    (@crackajax)

    I am marking this as resolved. I will update my code to check both meta keys for the token and I am thinking it will fire perfectly in tonights cron job. If any further issues, I will open a new ticket.

    Thanks again @dougaitken !!

    Thread Starter crackajax

    (@crackajax)

    @dougaitken thanks for getting back to me. The cron job will run again overnight and I hope to resolve this for my client.

    But, I want to be clear, that the issue regarding the token is strictly the plugin code and not affected by any other customization outside of the filter: add_filter( ‘wc_stripe_force_save_source’, ‘__return_true’ ); The custom code creates and charges orders in a script that only runs on the 1st day of the month via a cron job.

    That being said, I deactivated ALL plugins except Woocommerce and Woocommerce Stripe and activated the Twenty Twenty theme just to be sure. I added the filter: add_filter( ‘wc_stripe_force_save_source’, ‘__return_true’ ); to the top line of the Twenty twenty functions.php file as the only customization in the system. With this minimal setup, I created an order with my Stripe sandbox settings to test. The transaction does go through and I can see the user in my Stripe Test Data, but it did not save the card it appears, nor did it add the _stripe_customer_id to the wp_usermeta table. From My Stripe Dashboard:

    EMAIL DESCRIPTION DEFAULT SOURCE CREATED

    donnie+testytesty@crack-ajax.com
    Name: Testy Testy, Username: Testy

    Jul 31, 1:04 PM

    So, with the minimal setup two important pieces of data do not seem to be occurring as expected. I know this was working correctly at one time as the customers who bought into the system prior to March 2020 do have the tokens and the cards are saved. Since March 2020, the clients that have bought in are in Stripe and it appears their cards are as well (even though I don’t see the cards in my test today) AND the stripe id is in the wp_usermeta table. So, it is clear that something has changed in the WC Stripe plugin given this result – totally independent of any custom code other than the force save card filter.

    As a hunch, I just searched the meta key filed in the wp_usemeta table for anything %stripe% and lo and behold, I see my three test customers I have created during the troubleshooting we have done over the last 3 months, and sure enough there is a meta key with the token, but the meta key is no longer:

    _stripe_customer_id

    it is now:

    wp__stripe_customer_id

    This is the source of the entire issue and one that I would have hoped you could have provided in support of your plugin 3 months ago. This token is necessary to do an auto charge because how else do you identify the Stripe user in order to charge their crd for a given order?

    Anyway, this turns out to be the answer to this question on two tickets, and hopefully any developer in the future will find this useful if they encounter the same issue. I would also suggest that the documentation for the plugin is also updated with this information as well.

    Thanks for all your help,
    Donnie

    Thread Starter crackajax

    (@crackajax)

    Is anybody home? This issue has been active for 6 weeks now without resolution. @dougaitken was helping until he closed the https://wordpress.org/support/topic/forced-save-card-customer-creation-not-working/#post-12998349 ticket and said to open a new one. Can someone please help?

    The issue has been narrowed down to the Stripe token, and the WC Stripe plugin is not putting it in the database recently – but it was prior. Id this still necessary to do the automated orders or no longer required?

    Thread Starter crackajax

    (@crackajax)

    So, is there a bug with the plugin not saving the token when using the force save filter?

    Is there a way to add the token after the fact given that the customer account is created in the Stripe account as is the credit card stored, but the token is not entered into the WordPress database?

    Or, do I not need the token in order to auto charge the customer now?

    I currently have:

    //Charge user via Stripe API
    $charge = \Stripe\Charge::create([
    ‘amount’ => $totalNoDec,
    ‘currency’ => ‘usd’,
    ‘customer’ => $tokenString,
    ‘description’ => ‘Tiffany Andersen Brands – Order ‘ . $order->get_id()]
    [‘idempotency_key’ => $order->get_id(),
    ]);

    But, before I hit the API, I am checking for the token in the WordPress database:

    //Get Stripe customer token that was created when the card was saved in woo
    $tokenString = get_user_meta($user_id, ‘_stripe_customer_id’, true);

    //If no token string, then user does not have a credit card on file
    if ( empty( $tokenString ) ) {
    $this->record_error_to_log( ‘User has no credit card on file for VIP Order #’
    . $order->get_id() . ‘ for User ID #’ . $user_id );
    return;
    }

    Is this even necessary now? Will the order go through without the token?

    Thread Starter crackajax

    (@crackajax)

    @dougaitken I have had the client check her Stripe for the actual customer account creation and if they see the credit card on the account. As it turns out the customer account was created and a credit card is present for the two customers whose accounts failed on the automated order. Their accounts were created on the day they setup their Woocommerce accounts on the site. The automated orders take place on the 1st of each month thereafter.

    For the existing customer in the program prior to these two new ones, their card gets charged and the order created. But the new customers who are buying in (simply by buying a tagged product in the Woocommerce shop – nothing custom going other than setting a user capability when purchasing a certain item), even though their customer account is created in Stripe, and the credit card associated, the _stripe_customer_id is not being set in the WordPress user_meta table.

    I am checking in my custom code for the Stripe token before hitting the API and if not found for the customer ID, it logs the error, User has no credit card on file, and returns. So, does the filter, add_filter( ‘wc_stripe_force_save_source’, ‘__return_true’ );, trigger the creation of the Stripe token? Should it be stored by the plugin as part of the transaction?

    Thanks.
    Crack-Ajax

    • This reply was modified 3 years, 10 months ago by crackajax.
    • This reply was modified 3 years, 10 months ago by crackajax.
    Thread Starter crackajax

    (@crackajax)

    @dougaitken thanks so much! I have been testing to there expecting the checkbox. It is the client’s Stripe account, and I don’t have access there to verify the customer creation. I will setup my own Stripe account on the dev site and verify that way. Thanks again!

    Thread Starter crackajax

    (@crackajax)

    @dougaitken I have deactivated all plugins except Woocommerce and the Woocommerce Stripe addon. I activated the Twenty Twenty theme and added the filter to the functions.php. With this very simple setup I am still not getting this to work. So, perhaps I am testing it incorrectly. Here are my steps:

    1) Add product to the cart.
    2) Go to checkout.
    3) Login with my test user.
    4) Check the Save payment information to my account for future purchases. checkbox to be checked, but it is not.

    I do have Stripe in test mode. I have verified that the Enable Payment via Saved Cards under the Stripe Payment settings (Woocommerce >> Payments >> Stripe >> Manage) is checked. There is no custom code in this scenario, just WordPress core, Twenty Twenty them (with the inserted filter below), Woocomerce & Stripe plugins.

    So, should the checkbox be checked automatically when using the add_filter( ‘wc_stripe_force_save_source’, ‘__return_true’ ); filter? Or, does this not work if Stripe is in test mode?

    Any ideas or leads for further investigation are appreciated.

    Thanks,

    Thread Starter crackajax

    (@crackajax)

    @dougaitken I am using a cron job the 1st of each month to create a preselected assortment of products to build an order and using Stripe API to charge payment. It has been running for a year without problems other than the forced save card issue. Does that answer your question?

    Thread Starter crackajax

    (@crackajax)

    Thanks Gabriel! That lead me to the solution.

    The problem is that the developers changed query variables in the url and IDs in the HTML that broke my custom system dependencies.

    The Login/Password Reset form used to have the id=”loginform” and it was changed to id=”wppb-loginform”. This broke the styling on this form causing all of my multisite forms to look really bad.

    The issue reported in this ticket was that formerly the password reset query string included ?submitted=yes, which I was parsing in my JavaScript, and if present, add a class=”reset-password” used to either hide/show the login form versus the reset form. This query variable was removed from the reset url sent in the email. I have updated my JavaScript to detect the “key” variable to accomplish the same thing.

    Unfortunately, these changes caused a lot of pain for my client’s customers. I would politely ask that when updating your plugin that changing IDs, classes and query variables that more care be taken with such changes so that developers relying on those selectors will not have broken sites unexpectedly.

    Thanks for all your help in getting me there.

    Thread Starter crackajax

    (@crackajax)

    Hi Gabriel,

    I created a test page at https://submityourloanapplication.com/password-reset/ with the password reset shortcode only, but it does not work. But, if you add the query string ?submitted=yes it does.

    The registration page is at https://submityourloanapplication.com/user-registration/ for testing.

    (I apologize for the late response – I replied in the email notification and apparently you do not get those).

    Thread Starter crackajax

    (@crackajax)

    @wpmudev-support9 Hi Nastia, we are going in circles on this. We already went through these steps here: https://wordpress.org/support/topic/gzip-headers-issue/#post-12416676. Is there anything new you can add or want to try? Is the new information regarding the iframe with Google Maps perhaps the issue? Or do you think it is not the iframe and must be something else?

    Thread Starter crackajax

    (@crackajax)

    @wpmudev-support9 I think I may have figured out the issue. I have been spot checking several pages on my site regarding this issue. My clients have been reporting the contact page that they cannot access specifically. In my spot check all the pages did come up except the contact page, which reported the Content Encoding Error (net::ERR_CONTENT_DECODING_FAILED) error. It will clear when I clear the cache and load fine. But, the thing that makes that page different is that it has a Google Map iframe embedded. I am thinking this is the reason it throws the error. The specific page is https://crack-ajax.com/contact-crack-ajax-web-technologies/. Is there a way to turn caching/Gzip off for this page only?

    Thread Starter crackajax

    (@crackajax)

    @johndcoy while it is definitely important that Jetpack is hooked up, it is not the reason causing this issue. I recently had an absolute nightmare experience with Woocommerce and the wordpress.com login accounts getting crossed and they recently deleted one of my accounts with the Jetpack association for this account. While I thought this had all been resolved, and it has been reinitiated in this site, the tax issue predates the jetpack connected issue and I wanted that to be clear here.

    Thread Starter crackajax

    (@crackajax)

    Hi Adam,

    I only got cache control headers set in my .htaccess, but no other caching going on.There are definitely no other caching plugins installed.

    Thanks,
    Donnie

Viewing 15 replies - 1 through 15 (of 24 total)