iFrame Payment Session
Overview
Payment partners can add a new optional boolean parameter use_iframe to the endpoint for creating a new payment session.
Setting use_iframe to true will return an iframe-compatible URL in the redirect_url property of the response.
Example Request
Example Response
Handling iFrame Responses
Partner sites can set the iframe element’s src to redirect_url and this will render Truemed’s survey and checkout in the iframe. A message event listener will need to be added to listen for messages from the iframe. Upon completion of the survey and payment, Truemed will send a message from the iframe to the parent using the browser’s PostMessage API with two parameters success and redirect_url. After handling the message, the iframe can be removed.
success- boolean that returnstrueif checkout flow was successful on Truemed’s end,falseif otherwiseredirect_url- string that will be set tosuccess_urlfrom the original create request body ifsuccessistrueorfailure_urlifsuccessisfalse. Only need to be used if redirect is desired or need to handle success and failure differently.