Delay retrieving saved customer cards

I’m seeing some delays with customers being able to use a card they have just saved. The workflow in our app is:

  1. Customer adds items to their cart on our end
  2. Customer is prompted to create an account to check out (if they haven’t registered before.)
  3. Customer registers and saves a card using the Square card form.
  4. Checkout is completed using the card they have saved.

Most of the time this seems to work, but on a few occasions I’m seeing “NOT_FOUND: Card on file not found” errors when trying to check out with a card that was recently saved.

The latest error has this timeline (PDT timezone):
10:45am: user registers on our app
1:51pm: they try to place an order
3:47pm: user info was updated on Square.

The order they tried to place was unsuccessful due to the “card not found” error. Looking at their info from the customers API, they have 2 of the same card saved, which confirms what they saved on our end. It looks to me like there was a 2 hour delay actually saving the cards to their Square account though?

Customer ID is AMJGCMYEPH1J91TTDN5PN0BYH4 if that helps.

This is one example, but we’re seeing these sporadically every day or so. Should we expect a delay between a customer saving the card and actually being able to use it?

Could you provide any other customer_ids this is happening with? There definitely shouldn’t be a 2 hour delay between being able to use it. I do not see any “card not found” errors with the customer id provided. Is this with the CreatePayment request?

If any more pop up I’ll add the ID’s here. Thanks for looking into this.

And yes, it was the CreatePayment request that threw the error.

The order ID was GrNwATZczanYpfvPJuuIeBNtib6YY for this instance.

Thanks, I found that order and payment, but it’s for a different customer (WQ9RGAG9SCVZ93V1FGSH52V294). I can confirm that the card id passed does not match the card id that is on file for this customer, though.

Hmm…that’s odd. Fetching the user from Customers API:

Returns user with ID AMJGCMYEPH1J91TTDN5PN0BYH4.

Ahhh probably a merged customer then. That’s probably their old id :slightly_smiling_face:. Regardless in the request I found, it was passing the wrong card_id though which is where the error is coming from.

I can’t tell which card ID was used for the payment request from my end, but the only 2 cards I have on record for this customer match the two in the customer returned from the API:


Would using the old customer ID cause the error?

Talking to the payments team about this to make sure I don’t miss anything, but from what I see so far:

WQ9RGAG9SCVZ93V1FGSH52V294 owns ccof:GLMgdVAeewK1tLMu3GB
6FS7196TMMX1X8QPYA4JMP17PR owns ccof:M68JDfWrC2JLZBuh3GB
and it looks like the two of these were merged to make AMJGCMYEPH1J91TTDN5PN0BYH4.

However in the CreatePayment request, at least in the logs we received, WQ9RGAG9SCVZ93V1FGSH52V294 and ccof:M68JDfWrC2JLZBuh3GB were passed (and not AMJGCMYEPH1J91TTDN5PN0BYH4) which do not belong together. So if WQ9RGAG9SCVZ93V1FGSH52V294 (the old id) is used, then yes it would return this error.

Ah, ok. So we were sending old ID #1 with old ID #2’s card. I didn’t see any webhooks for customers api - is there any way for us to be notified if they have been merged aside from seeing an error when they try to pay? If that happens after someone creates an account through our app, we wouldn’t be aware of it, and would have the old customer ID, which seems to be what happened here.

Hi @shannonf. I’m the Product Manager for Customers API. We don’t have Webhooks publicly available quite yet for providing notifications for customer-related changes (including merges), but this is something we’re actively working on. I will DM you!

I’m still seeing this behavior intermittently. Here is an example of a customer that wasn’t merged. ID ZWZFZ6M0355FNDT8SBE3EXAP4C, created at 2021-01-05T19:30:24.124Z, at which point they would have also added a card (adding a card on our end is what prompts creating the customer on Square.)

They tried to place an order at 2021-01-05T19:34:07.476Z, paying for the order was not successful as it returned a Card on file not found error. The order ID is G98fyDktwsnoFiDCCpCQM7DYphPZY.

Looking at the customer now, I see 2 cards saved to them both in Square and on our end, both are the same card (same last 4 and exp date). The card that was used for the order is ccof:mLWng7qur51nfT6d3GB, which I see listed under their cards on their Square info.

What would be causing the Card on file not found error here?

The customer_id used to pay for order G98fyDktwsnoFiDCCpCQM7DYphPZY was XRHJ9NAQX0RK757ZWPSVJDKNZW, which is different than what you supplied above.

Furthermore, ZWZFZ6M0355FNDT8SBE3EXAP4C was created as a result of a merge (I see that as the source in the customer directory). It looks like the original two customer_ids were GYK1QVA9CWY239DBZRMCYF4AHM and XRHJ9NAQX0RK757ZWPSVJDKNZW. In this case, XRHJ9NAQX0RK757ZWPSVJDKNZW was passed in the CreatePayment request, but ZWZFZ6M0355FNDT8SBE3EXAP4C is the owner of the card on file, thus the error was thrown.

Can you tell if there was a webhook event sent for the merge? I don’t see any requests posted to our callback for the time when the customer data says it was created or updated.

I see a customer.created webhook was sent at 11:54 AM PST today (1/05) when the customer was merged. The created_at is from the oldest customer’s created_at, I believe.