{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Callback functions","description":"Tyro Health Docs","keywords":"redocly developer portal, api portal starter, api reference docs","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"callback-functions","__idx":0},"children":["Callback functions"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Callbacks are functions that you can provide to a method in the SDK which will give you feedback when an event occurs."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["They can be useful when you want to record data & attributes at a particular stage of a transaction."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Callback"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":""},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Description"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onSuccess"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Invoked when the transaction, claim (when applicable) & payment is successful.Warning: This callback will not be invoked if the user closes the modal before a successful transaction. You can use the invoiceCompleted Webhook to track the transaction outcome."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onFailure"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Invoked when the payment has failed."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onCancel"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Invoked when the payment has been rejected."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onClosed"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Invoked when the pop-up window has been closed by the user before approving or rejecting the payment."]}]}]}]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When using the checkout SDK, users will need to pass a callbackOrigin(The URL of the booking website)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["When using the SDK, do not pass through any callbackURLs as the SDK will fire callbacks at completion to your website."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Examples"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"js","header":{"controls":{"copy":{}}},"source":"import medipassCheckoutSDK from '@medipass/checkout-sdk';\n// or: const medipassCheckoutSDK = require('@medipass/checkout-sdk');\n\nmedipassCheckoutSDK.init({\n  env: 'stg',\n  onSuccess: ({ transactionId }) => {\n      // handle success\n  },\n  onFailure: ({ transactionId }) => {\n      // handle failure\n  },\n  onCancel: ({ transactionId }) => {\n      // handle cancel\n  },\n  onClose: () => {\n      // handle close\n  }\n});\n\n","lang":"js"},"children":[]}]},"headings":[{"value":"Callback functions","id":"callback-functions","depth":1}],"frontmatter":{"title":"Callbacks","seo":{"title":"Callback functions"}},"lastModified":"2026-03-05T03:54:02.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/developer-portal/checkout/callbacks","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}