# Receipt URL in Payments API createPayment method Issue

**URL:** <https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223>\
**Category:** Questions\
**Tags:** payments-api\
**Created:** [November 10, 2020, 7:42pm UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223 "2020-11-10T19:42:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blawkyy](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/blawkyy/32/233_2.png) [@Blawkyy](https://developer.squareup.com/forums/u/Blawkyy)\
**Post date:** [November 10, 2020, 7:42pm UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223/1 "2020-11-10T19:42:33Z")

</div>

I am trying to utilize the payment.receipt\_url link that comes from the response on a Payments API createPayment request.

In my backend I immediately take the response I get from the Payments API, get the HTML from the receipt\_url link and attempt to send it to the customer’s email. However When I received the email I get the following:

![image](https://global.discourse-cdn.com/square/original/1X/ced4358460ee79f70537a35686eda34f7cfa0802.png)

I had seen this problem in Sandbox and assumed it was just a Sandbox bug as I think I remember reading something about that being a known bug. You can see the issue at the following example Sandbox receipt\_url:  
[https://squareup.com/receipt/preview/Jg6oJ8iUN56EZuzEdlEpBnrgfIfZY](https://squareup.com/receipt/preview/Jg6oJ8iUN56EZuzEdlEpBnrgfIfZY)

However now that I have tried it in Production, I am still receiving the error.

I went to my server logs and clicked on the URL myself, and it worked fine! You can see that here:  
[https://squareup.com/receipt/preview/7pA79xUIKzS551juzpX0cxkHBy9YY](https://squareup.com/receipt/preview/7pA79xUIKzS551juzpX0cxkHBy9YY)

Is it possible I have to implement some sort of wait to allow the Square server to catch up before trying to grab the HTML from the URL? Or is there something else I am missing? I can’t find anything in the documentation about this.

---

<div class="post-metadata">

**Author:** ![sjosey](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/sjosey/32/40_2.png) [@sjosey](https://developer.squareup.com/forums/u/sjosey)\
**Post date:** [November 11, 2020, 4:15pm UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223/2 "2020-11-11T16:15:57Z")

</div>

Hm, I wasn’t aware a wait was necessary either. Do you know if this consistently happens in production now that you’ve moved there? Does this error come up every time you try to redirect to the receipt url?

---

<div class="post-metadata">

**Author:** ![Blawkyy](https://sea1.discourse-cdn.com/square/forums/user_avatar/developer.squareup.com/blawkyy/32/233_2.png) [@Blawkyy](https://developer.squareup.com/forums/u/Blawkyy)\
**Post date:** [November 15, 2020, 6:18pm UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223/3 "2020-11-15T18:18:33Z")

</div>

FYI, I realized I needed to change my architecture anyways and it appears this has fixed the problem as it creates an implicit wait.

My original architecture had the user waiting for the email to be sent before getting a response back that their order was submitted which I have learned is BAD.

I made that emailing process asynchronous with a queue and another lambda dedicated to sending email confirmations. I put a small wait on the queue processing the messages and now the receipt comes through nicely each time.

---

<div class="post-metadata">

**Author:** ![Salvatore](https://avatars.discourse-cdn.com/v4/letter/s/ea666f/32.png) [@Salvatore](https://developer.squareup.com/forums/u/Salvatore)\
**Post date:** [November 14, 2021, 2:43am UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223/4 "2021-11-14T02:43:30Z")

</div>

Hi ,

I implemented TERMINAL API and also the SquarePayform ( Website ) for a client a while ago . I recently made a change to also capture the returned receipt\_url string and save it into a table so we can email later…

I seem to be getting a similar behaviour as the returned json string sometimes doesn’t contain the receipt\_url , but when I go and query the payment id later it’s there .

Should I also be looking at implementing some form of wait ?

Regards,  
Sam

---

<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:** [November 15, 2021, 4:49pm UTC](https://developer.squareup.com/forums/t/receipt-url-in-payments-api-createpayment-method-issue/1223/5 "2021-11-15T16:49:16Z")

</div>

I didn’t think a wait was necessary however if you do a retry is the URL in the next call? If so you could either do a wait or implement a retry method. 🙂
