createPaymentLink returned urls often 404

I’m building a new checkout flow with the Node.js SDK createPaymentLink function. As soon as the link is received I redirect the user to it. Fairly often (I’d say > ~50%) of the time, the link 404s. If I wait a short time and then reload the page, everything is fine.

It almost seems like the SDK is returning links before the page is publicly available.

Is this a known issue? It’s a blocker for me as I can’t be redirecting users to a page that’s going to 404. The only workaround I can think of is artificially delaying my redirect after the link is received.

:wave: Often time there are some asynchronous functions that happen on the Square side that can cause a slight delay. I’ve mentioned this to the team and they are looking into it. :slightly_smiling_face:

1 Like

What’s your application Id and do you have some example links that you got the 404 with? :slightly_smiling_face:

Hey Bryan. Thanks for getting back to me and raising this to the appropriate team.

My application ID is sq0idp-_FTXysYP5BEOKhT2X6zO_Q

Here’s a payment link that I got to 404 before reloading: FMC Testing

I got that 404 on my 2nd try FYI.

So it worked on the first try and failed on the second?

No, I only tried generating payment links twice before I encountered the issue.

  • I generated a payment link, and the payment page loaded just fine.
  • I generated a second payment link, and that one 404’d. (The one linked above)

Sorry if I confused ya!

Okay, that makes sense. The team is going to look into this. :slightly_smiling_face:

Hey Bryan, any chance there’s an update on this? Just tried to reproduce this again and I got the error on my first try.

Hey @dtf, we’re still looking into this! We found something earlier today that we suspect may be related, but we’re still verifying. Thanks for your patience!

Hi @josh-square, I’m also experiencing this problem. Just wondering if there has been any progress on a potential fix.

Is there anything we do in the meantime? as in, being able to check if the link is ready before redirecting the users to it?

We could make a fetch() HEAD request till getting a 200 response but it’s blocked by CORS (as it probably should) but is there any Square API we could poll on or something?

1 Like

Currently there isn’t any additional API to poll. The team did implement a fix for this. When was the last time you got the error? :slightly_smiling_face:

@Bryan-Square Glad to hear to hear of some movement on this. I just tried to reproduce this again. First attempt went well, second failed. :frowning: Here’s the link that was generated.

Hmm, okay I’ll let the team know. :slightly_smiling_face:

1 Like

Thanks for the quick reply, @Bryan-Square. I’ve just started implementing this functionality this week, and have been getting the error since the start of the week.

1 Like

Is there any progress on this. I’ve only just programmed the create payment link and I’m having to reload on about 50% of test transactions.

1 Like

Do you have a recent link that you got the error with? :slightly_smiling_face:

The test was not on sandbox so the link is live. Is it safe to publish it here?

Yes, it’s safe to post here. Thanks for asking. :slightly_smiling_face:

hi @Bryan-Square, I got the error on this one Checkout API Sandbox Testing Panel

1 Like

I assume this still isn’t fixed, as I am seeing the same problem. Not sure about how to work around this.