# Redirection after deleting payment link

**URL:** <https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087>\
**Category:** Questions\
**Tags:** checkout-api\
**Created:** [October 9, 2024, 9:33am UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087 "2024-10-09T09:33:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kishanv](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@kishanv](https://developer.squareup.com/forums/u/kishanv)\
**Post date:** [October 9, 2024, 9:33am UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/1 "2024-10-09T09:33:51Z")

</div>

In our system, we give customers a fixed amount of time to complete their transaction after adding a product in cart and proceeding to checkout. If the customer doesn’t make a payment before the timer expires, we cancel the order.

My question is:  
How can I prevent customers from making the payment on the Square checkout payment page created by the `v2/online-checkout/payment-links` API?  
I found this API that deletes the payment link (`/v2/online-checkout/payment-links/{id}`), which prevents the customer from completing the payment. However, the issue is that the Square payment page isn’t redirecting the customer back to my website.

**In short:** I want to ensure that customers cannot complete the payment on the Square payment page after a fixed amount of time, and then the Square payment page redirects customers back to my website. This is crucial.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [October 9, 2024, 9:34am UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/2 "2024-10-09T09:34:11Z")

</div>

👋 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:

> **[Online Payment Solutions](https://developer.squareup.com/docs/online-payment-options)**
>
> Learn about the Square APIs and SDKs that support eCommerce (online) payment processing.

> **[Guidelines and Limitations](https://developer.squareup.com/docs/checkout-api/guidelines-and-limitations)**
>
> Learn about Square Checkout API guidelines and limitations.

> **Additional Documentation**
>
> [Checkout API](https://developer.squareup.com/docs/checkout-api)  
> [Payment API: Process Online and In-Person Payments](https://developer.squareup.com/docs/payments)  
> [Delayed Capture of a Card Payment](https://developer.squareup.com/docs/payments-api/take-payments/card-payments/delayed-capture)

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.

---

<div class="post-metadata">

**Author:** ![Square-Dev-AI](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/square-dev-ai/32/2513_2.png) [@Square-Dev-AI](https://developer.squareup.com/forums/u/Square-Dev-AI)\
**Post date:** [October 9, 2024, 4:16pm UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/3 "2024-10-09T16:16:00Z")

</div>

The Square Checkout API currently does not support a built-in timer functionality to automatically expire a checkout page after a certain amount of time. However, you can implement this functionality on your own server.

You can set a timer on your server for each checkout session. When the timer expires, you can call the DeletePaymentLinks endpoint to delete the payment link. This will prevent the customer from completing the payment on the Square checkout page.

As for redirecting the customer back to your website, you can specify a redirect URL when creating the checkout page using the `redirect_url` field. After the buyer completes the checkout flow, Square will redirect them to this URL. However, please note that this redirection will happen only after the buyer completes the checkout flow, and not when the checkout page is cancelled or deleted.

If you want to redirect the customer back to your website when the checkout session expires, you would need to implement this on your own website or application. For example, you could implement a timer on your website that corresponds to the checkout session timer on your server. When the timer on your website expires, you could automatically redirect the customer to a different page.

_This answer was reviewed by @Bryan-Square._

---

<div class="post-metadata">

**Author:** ![kishanv](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@kishanv](https://developer.squareup.com/forums/u/kishanv)\
**Post date:** [October 10, 2024, 6:27am UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/4 "2024-10-10T06:27:06Z")

</div>

I already have timer and timeout handling functionality on my website. But if the customer doesn’t get redirected back to my website from the Square payment page, how will that work? The issue is that the customer stays on the Square payment page after deleting the payment link using the delete API.

---

<div class="post-metadata">

**Author:** ![josh-square](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@josh-square](https://developer.squareup.com/forums/u/josh-square)\
**Post date:** [October 10, 2024, 6:46pm UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/5 "2024-10-10T18:46:53Z")

</div>

Hey @kishanv! Unfortunately this isn’t something that the the Checkout API supports currently; there is not a mechanism for redirecting customers upon payment link deletion.

---

<div class="post-metadata">

**Author:** ![kishanv](https://avatars.discourse-cdn.com/v4/letter/k/aeb1de/32.png) [@kishanv](https://developer.squareup.com/forums/u/kishanv)\
**Post date:** [October 14, 2024, 4:39am UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/6 "2024-10-14T04:39:49Z")

</div>

Hi,  
Is there any other way to do it?  
The requirement is that if a customer tries to complete the payment after a certain fixed time, the payment should fail. The customer should not be charged and should be redirected back to my website.

---

<div class="post-metadata">

**Author:** ![Bryan-Square](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/bryan-square/32/38_2.png) [@Bryan-Square](https://developer.squareup.com/forums/u/Bryan-Square)\
**Post date:** [October 15, 2024, 4:01pm UTC](https://developer.squareup.com/forums/t/redirection-after-deleting-payment-link/19087/7 "2024-10-15T16:01:13Z")

</div>

At this time the redirect for a payment link only works on a successful payment. We’re constantly working to improve our features based on feedback like this, so I’ll be sure to share your request to the API product team. 🙂
