Is it possible to set a "return_url" on an invoice link?

On the flow that we are implementing for our customers, we have create the subscription without the card_id, which causes an invoice to be created and an email to be sent to the customer. We are also using the API to retrieve that invoice and redirect the user to the invoice url. But we want the user to go back to our website after he completes payment on Square.

Is it possible to have a return_url parameter on the invoice payment URL, that redirects the user after he finishes payment?

: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

Invoices API
Create and Publish Invoices
Square Developer

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.

No, the Invoices API does not currently support a return_url parameter that would redirect the user back to your website after completing the payment. The user would remain on the Square-hosted invoice payment page after the payment is completed.

This answer was reviewed by @Bryan-Square.

One of the possibilities we are discussing is to open the invoice link as an iframe. Because then we can close the iframe and continue our flow, once we have detected that the user have paid the invoice.

I have not tried this yet, but do you think this would work? I’m only concerned that perhaps Square has a reason not to allow the invoice to be opened as iframe.

Normally if you try to load our provided payment methods in an iframe they won’t load due to security reasons. :slightly_smiling_face:

Seems reasonable. Thank you.