investigator
investigator10mo ago

Using Payment Window inside iframe

Due to the nature of our integration, we need to render Payment Window inside an iframe. This iframe renders the payment windows calling another application so the iframe and the content are in different domains. This is problematic in PC as the redirection tries to change the parent location (parent of the content is the window where the iframe is rendered), but due to cross origin policy, Toss Payment Window cannot change the location of the parent. We get "Failed to set the href property on Location: The current window does not have permission to navigate the target frame to {successUrl}. Is it possible to detect when Toss Pay Payment window will perform a redirection so we can pass the redirection url to the parent iframe and the parent do the redirection? Thanks.
6 Replies
토스페이먼츠 BOT
⏳ 잠시만 기다려주세요! 곧 답변드리겠습니다
오류 문의일 경우 아래 정보를 미리 전달해주시면, 빠른 답변에 도움이 됩니다.
- 주문번호(orderId) : - 문의 내용 :
(img를 함께 첨부해주시면 도움이됩니다)
* 계약관련 내용은 1544-7772로 문의주세요. * 주말/공휴일에는 답변이 늦을 수 있어요.
Kimoon Lee
Kimoon Lee10mo ago
you can use "windowTarget" : "self"
investigator
investigator10mo ago
Would there be any way to keep it in iframe mode but detect the redirection and allow me to handle the redirection? 🙂
Kimoon Lee
Kimoon Lee10mo ago
you can create your own iframe then call the payment window inside of it.
Ayaan
Ayaan10mo ago
Hi @investigator , thank you for reach us. Sadly, due to Chrome's CORS blocking, we don't recommend using paymentWindow product within an iframe. If you set "windowTarget": "self" in requestPayment function, you can render paymentWindow within an iframe, but not recommended. (Because our service needs to redirect several cross-origin resource; and only some payment methods work well) However, we offer a product called paymentWidget which allows you to integrate our payment service as a widget into your already developed site without using an iframe. If you really want to use iframe, please use "windowTarget": "self", but when it has issue, you need to consider to integrate with paymentWidget. Thank you for using Toss Payments' service!
토스페이먼츠 BOT
❤️ 기술문의 경험이 어떠셨나요?!
간단히 코멘트 남겨주세요! 제품 발전에 큰 힘이 됩니다.