Afterpay not updating with PaymentRequest

This is a recent issue, I have not had this behavior in the past. With no changes to our underlying logic for processing an Afterpay payment, it appears at some point the ability for the Afterpay context to update with the PaymentRequest object is not functional. I wanted to follow up to see if anyone else was experiencing this issue, I see no mention of Afterpay being a unique exclusion in the webpayments sdk docs.

To be specific, in a scenario where a customer may change the quantity of a product, remove a product from their cart, etc. on the checkout page where the Afterpay button is attached, we call the initiating payment requests’ update function to update the cart total. All other payment methods supported by square will update their cart total (and even afterpay use to have this behavior in sandbox) however as of recently this no longer works. Afterpay does not rehydrate with the new payment request when the object is updated. This causes payments to fail because of order total mismatch. Is this expected behavior for afterpay? If so this seems like a clunky solution to reinitialize a new afterpay instance every time the request details change.

Are you able to replicate this and what’s your application ID? Also is the page this is happening with accessible so we can replicate? :slightly_smiling_face:

Here is the sandbox application ID: sandbox-sq0idb-j6U0SMfEc8kVom5S3A7PZw
Unfortunately I’m not easily able to share with you the page this is happening on but I am enable to reproduce this behavior every time.

To summarize how I reproduce:

  1. Create a payment request. payments.paymentRequest(...details about order)
  2. next I activate the afterpay payment method. await payments.afterpayClearpay(paymentRequest)
  3. I attach afterpay checkout button to the page. await afterpay.attach(... afterpay pay container)
  4. Lastly, I listen for a checkout update event, and will call paymentRequest.update(...new order details) whenever this occurs

The issue I’m facing: After this checkout update event occurs (for an example, a user changes the quantity of an item), the new order total is not reflected in the afterpay popup session (it will show the cart total as the old order total). This causes afterpay to fail if the customer continues with the purchase since the payment created on the sever has a different order total than what afterpay had in its context.

Afterpay is the only square method with this issue that I have encountered, we use the same paymentRequest with card, cashapp, ach bank, and all work fine and update correctly with the paymentRequest without an extra steps.