Support » Plugin: Afterpay Gateway for WooCommerce » Afterpay marks non-Afterpay orders as PAID

  • Resolved vahanavagyan1

    (@vahanavagyan1)


    Hi guys. Afterpay’s most recent Apr 28th update causing havoc. Plugin now randomly marks non-Afterpay orders (PayPal, CC, etc.) as “PAID”, inserts Afterpay ID next to non-Afterpay “Paid via” and then you can’t even find that Afterpay ID on your Afterpay dashboard. This is a REAL bad mess and I’ve already reported to Afterpay team with screenshots, etc. I hope Afterpay devs are quick and qualified to figure the bug out and patch. Meanwhile, we’ve trained our team to spot such inconsistencies to stop an order before it’s too late. Stay vigilant.

Viewing 15 replies - 1 through 15 (of 27 total)
  • This is probably scary and annoying, but in order to resolve it, you’ll need to provide more information.

    For example, do you have any custom code dealing with order creation or payment that may need to be adapted?

    Is your theme fully compatible with the latest WooCommerce?

    Are there any other payment plugins active on the site, other than those in core WooCommerce and Afterpay?

    What version of WordPress and WooCommerce are you on?

    Do you see any relevant message in the browser console, error_log or wp-admin/error_log?

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    Do you have any custom code dealing with order creation or payment that may need to be adapted?
    > Sure.

    Is your theme fully compatible with the latest WooCommerce?
    > Yes.

    Are there any other payment plugins active on the site, other than those in core WooCommerce and Afterpay?
    > Sure.

    What version of WordPress and WooCommerce are you on?
    > Latest.

    I’d rather share all the details w/ Afterpay dev team (there is an internal ticket w/ Afterpay and so far no updates).

    It’ll be great if you could update this thread with the outcome when you know it. I’m not updating from 2.2.2 yet and hoping for the best 😉

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    Remarkably terrible. I keep seeing orders with mixed up Afterpay order IDs. Afterpay marks many orders as paid by completely different order/buyer’s Afterpay IDs even if the given order isn’t even Afterpay. This is insanity!

    Plugin Author Afterpay

    (@afterpayit)

    Hi @vahanavagyan1,

    Please find a technical explanation of the payment process below.

    Step 1: When the consumer clicks the “Place Order” button from the checkout page, WooCommerce calls the process_payment method of the WC_Payment_Gateway class (reference) that corresponds to the consumer’s chosen payment method. If Afterpay was selected at the checkout, this would be the WC_Gateway_Afterpay class.

    Step 2: At this point, the Afterpay plugin looks up the newly created Order using the Order ID provided by WooCommerce, and uses the Order information to create an Afterpay Checkout. The Afterpay Checkout token is then attached to the Order as meta data, and the consumer is redirected to Afterpay to confirm the payment schedule.

    Step 3: When the consumer returns from Afterpay, the Checkout token is appended to the WC-API URL for “WC_Gateway_Afterpay”. The Afterpay plugin uses the Checkout token in the URL to lookup the WooCommerce Order with which the token was associated in Step 2.

    This is the only point of the process that changed between version 3.0.0 and 3.0.1. Version 3.0.0 used the token to request the “Merchant Reference” (WooCommerce Order Number) from Afterpay. It then used this number to lookup the WooCommerce order. This failed if the Order Number differed from the Post ID (in cases where a third-party plugin had customised the Order Number).

    Version 3.0.1 instead uses the token to perform a post query for a WooCommerce Order in either “Pending Payment” or “Failed” status upon which the Afterpay token was attached in Step 2. The current estimation based on cases considered thus far is that third-party plugins are moving or copying the post meta that was originally created by Afterpay to one or more unrelated orders.

    Step 4: The token is then used to call the “Capture Payment” Afterpay API, and if approved, a note containing the Afterpay Order ID is attached to the WooCommerce Order, and its payment_complete method is called (reference). This method moves the Order into either “Processing” or “Completed” status, depending on whether shipping is required.

    During each step of this process, detailed information is recorded in the WooCommerce logs. This information will be beneficial for the support team as they continue working to investigate and resolve this challenge.

    The current plan is to release a subsequent patch that stores the unique, unchanging Post ID within the Afterpay system. This will allow the Afterpay plugin to reliably lookup the WooCommerce Order without depending on the integrity of any data stored within the WooCommerce system.

    Please expect further correspondence within 1 business day.

    Thank you.

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    Thanks for details. Pls vigorously test to not cause same or other issues. Thank you!

    Plugin Author Afterpay

    (@afterpayit)

    Hi @vahanavagyan1,

    Version 3.0.2 has now been released.

    This version changes the method of looking up the order to work around any third party plugin that may have moved or copied the Afterpay meta data from one order to another. When the Afterpay checkout is first generated from the order-pay page, it is linked to the unique Post ID of the order. This information is now stored by Afterpay instead of relying on the integrity of any data stored in WooCommerce. When the consumer returns after confirming their payment, the Afterpay plugin uses the token from the callback URL to make an HTTP request to Afterpay to retrieve the Post ID and lookup the order.

    This is more similar to the method used in version 3.0.0, except 3.0.2 also supports sending a customised Order Number to Afterpay as the “Merchant Reference”.

    As always, the recommended best practice is to test the update in a staging environment before updating in production. Please don’t hesitate to reach out if any further challenge is experienced.

    Marking this thread as resolved.

    Thank you.

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    Did you by chance add link from order to the Afterpay order page?

    @afterpayit Better etiquette would be to await the OP’s confirmation that the problem is actually resolved.

    @vahanavagyan1 Can you please confirm?

    Plugin Author Afterpay

    (@afterpayit)

    Hi @vahanavagyan1,

    Thanks for your question.

    From the order view within the WooCommerce admin, there will be a reference to the Afterpay Order ID. It will appear up the top beside the payment method, and in the order notes on the right. Neither of these references are hyperlinks to the Afterpay Merchant Portal. However, this can be explored as a potential inclusion in a subsequent feature release.

    Thank you.

    Plugin Author Afterpay

    (@afterpayit)

    Hi @galbaras,

    Thanks for your input. Marked as unresolved. @vahanavagyan1 please advise when the solution has been verified, then the thread will be marked as resolved.

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    Hi guys. I can only test tomorrow. Sorry.

    The same thing is happening to me. I’m sending out duplicated orders, losing money and inventory!

    My customers are also getting emails saying “paid thank you for your order”, Afterpay and my customers are saying they didn’t.

    Looks like Woocommerce is changing the “Order status from Pending payment to Processing”. When it’s not true.

    How can this be fixed?

    @danniee21 What version of Afterpay Gateway for WooCommerce are you on? If it’s not the latest, please update and check again.

    Thread Starter vahanavagyan1

    (@vahanavagyan1)

    @danniee21 3.0.1 was a nuclear disaster. Either SKIP to newest or download and set 3.0.0.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘Afterpay marks non-Afterpay orders as PAID’ is closed to new replies.