Create Payment Link page Returns 404, 422 errors?

Hi I have been trying to use the self hosted Create payments link page, I’ve successfully posted JSON data to the page, the correct information is being displayed.

When I go to pay it even does a verification with the bank depending on the card; however then it doesn’t do anything a loading icon on the button then it goes away.

Because this is self hosted on square I don’t get any feedback on why this isn’t working. except when I look at the console in chrome I see this? Also see image attached:

Failed to load resource: the server responded with a status of 404 ()
Failed to load resource: the server responded with a status of 422 ()

image

Here is the link: https://checkout.square.site/merchant/MLGX7WV5TY71X/order/ZFOl34di2SOYVgueSwr02TgibwfZY

Thanks

:wave: I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:

Additional Documentation

Checkout API
Checkout API
Get Started

If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.

Hi Conway,

Thanks for the example checkout link.

I’ve checked out the API Logs to get your CreatePaymentLink request body, and was able to reproduce the error.

I also tried creating my own request body from scratch, and I got a same error when I didn’t fill out the whole checkout forum. But when I did fill out the checkout, I was able to successfully take a payment in production on my own account.

My guess is that there is an issue with the request body, but the payment link is still getting created. But once a payment is attempt, you run into that error.

You’ll need to try tinkering with your request body and see what field and value might be causing the issue. For example, I see order → line_items[x] → "customer_id": "CUS" which is problematic, since Square orders will be expecting a real customer id.
Start by testing your order object. Try seeing if you can form the order via a CreateOrder. Then keep tinkering with the other request body keys and values.

See if you can avoid some empty values like:

    "shipping_fee": {
      "name": "Delivery",
      "charge": {
        "currency": "GBP",
        "amount": 0
      }
    }

or:
"pre_populated_data": {}

Let me know if you can find what part of your original request value for this payment link is causing an issue. You can find your API call in the API Logs.