Post processing checkout links payments

I’m new to square and trying to fully understand checkout links for a payment which would need a shipping address and various other details like custom fields.

I’ve created the checkout links including the custom fields on the dashboard, this was very easy.

What I’d like to do is for the customer to click on the checkout link on my website (no problem), go to the square hosted payment page (no problem), receive a confirmation email from square (no problem), go back to a “thank you” page on my website (no problem) and then I’d like to have all the details of the payment on my website like name, email address, shipping address, amount paid, etc. (this is where I get stuck).

I’d like to work in the above fashion so that I can do all the post processing I’d need, for example inserting the order details into a db, send out various emails using my web framework, etc, etc. So it seems this last part I’m unable to do. I can see the payment details on the dashboard, but I’d like to do automated post processing right after an order is placed and payment is completed.

I’ve read that checkout links don’t support webhooks. Is this correct? A webhook would be ideal for my setup, that way I guess square would send all order/payment details to an endpoint on my website and I’d be ready to go.

Is there a way to achieve something like this with checkout links?

So far I like checkout links because setting them up was really easy, I’m only stuck with how to get all order/payment details to my web app. For example, the “thank you” page can not receive this information in a POST?

Or I should move away from checkout links and use something else?

:wave: Checkout links for payments trigger payment and order webhooks. You can definitely listen for these events and then make any additional API calls with the IDs in the webhook payload. :slightly_smiling_face:

Thanks a lot Bryan!

I’m then probably good to go, if something is not clear I’ll come back here and ask away! :slight_smile:

Hi Bryan, I’m still new to square, just trying to figure things out :slight_smile:

So I’ve created the production checkout links and a webhook using the dashboard and now would like to test them in a sandbox environment. You mentioned in this thread

that production checkout links can not be tested in the sandbox, they need to be created in the sandbox, and then they can be tested.

But where do I create the checkout links in the sandbox dashboard? The production dashboard has this:

https://squareup.com/dashboard/ecom/online-checkout/checkout-links

But this doesn’t exist:

https://squareupsandbox.com/dashboard/ecom/online-checkout/checkout-links

And I don’t see “online checkout” or “checkout links” in the menu of the sandbox dashboard.

I’d like to create the checkout links in the sandbox dashboard so I exactly replicate what I’ve done in the production dashboard.

:wave: Currently the same checkout links that you can create in the Seller Dashboard in production aren’t available with Square Sandbox. What is available in both production and sandbox is the Checkout API. :slightly_smiling_face:

Thanks a lot Bryan!

So what would be the recommended way of testing checkout links?

You mentioned that checkout links trigger payment and order webhooks, which is great, this is what I’d like to test (I mean I’d like to test my webhooks). What’s the recommended way of doing this? Going for a full Checkout API implementation?

If you want to test checkout links that you create on the seller Dashboard you’ll need to test in production. You can do a $1.00 checkout and refund it. Otherwise if your going for a full Checkout API experience you shouldn’t use the links created on the Dashboard and just use the APIs to test. :slightly_smiling_face:

Hi Bryan,

Thanks a lot for all the help, I think I’m making progress :slight_smile:

Just to recap I have a checkout link for 1 product which has a number of variations (size). I’ve defined a webhook in php which listens to the

order.created
order.fulfillment.updated
order.updated
payment.created
payment.updated

events. In the sandbox if I send test events everything is working well, on my end I can see the payload sent by the triggered events. For example for an order.created event I get something like


{
"merchant_id":"XYXYYXYXYXYXYXYX",
"type":"order.created",
"event_id":"d422e8e0-58d2-4f30-8ce3c8207a7e8abd",
"created_at":"2022-10-01T20:51:38.786861957Z",
"data": 
    {
    "type":"order",
    "id":"XYXYXYXYXYXYXYXYXYXYXYXY",
    "object": 
     {
        "order_created": 
           {
              "created_at":"2020-04-16T23:14:26.129Z",
             "location_id":"XYXYXYXYXYXYXYXYXY",
             "order_id":"XYXYXYXYXYXYXYXYX",
             "state":"OPEN",
             "version":1
          }
      }
   }
}

Okay, so far so good. But when an actual order is placed from the checkout link how will I get which variation the order was made for, what the shipping address is and what the name/email/phone of the customer is?

With the order_id from the payload of the webhook you can call RetrieveOrder and get any additional details that aren’t in the order webhook payload. :slightly_smiling_face:

Thanks a lot again Bryan, I think I have everything now :slight_smile:

Hi @Bryan-Square, is there a roadmap for payment links created in the dashboard to appear via the API?

Currently I have a page that lists items from the Catalog API, but I want to have a checkout button for each that sends the user to a Square checkout where they can input their shipping details, choose their size of shirt etc.

I can hard code the link created in dashboard but hoping to have a more automated way of doing this.

If there’s a better way, let me know, thanks :smile:

The sizing options is where we run into a problem. Each size will need its own link. Also the links that are created through the Dashboard are limited. If your calling the API to create the link you have more customizable options with the orders vs. hard coding the link to your site. :slight_smile: