{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","openapiLink"]},"type":"markdown"},"seo":{"title":"Checkout (iOS SDK)","description":"Tilia Wallet Developer Documentation","siteUrl":"https://thunes-tilia-docs.redocly.app/","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":"checkout-ios-sdk","__idx":0},"children":["Checkout (iOS SDK)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The checkout flow wraps the complete payment experience, allowing users to select a payment method, then creates and pays the invoice."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/ios-checkout-final.98af8bf6729684924566682b61937005c34dec479de4a5f1c693aae0552178dc.9c1bb791.png","alt":"Tilia Hosted Checkout"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Authorized User Password Token (A User Password Token is a string that enables Tilia Wallet to verify that a request belongs to an authorized session)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Authorized Invoice ID (The ID for the Authorized invoice you created - see more info below)"]}]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All methods and flows in the Tilia SDK require you to have a server setup that communicates with Tilia’s APIs (your server will have a private api key which needs to remain secure and should never be exposed to client-side applications). Your client application should communicate with your own api (ensuring user authentication) to retrieve data required by the Tilia SDK."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"server-side-code-example-to-create-an-authorized-invoice-and-retrieve-required-information-for-the-sdk","__idx":2},"children":["Server-Side Code Example to create an Authorized Invoice and retrieve required information for the SDK"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Requires your server to retrieve a client credentials access token. See more ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/authentication"},"children":["here"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Requires an account id for a user that has been registered with Tilia. See more ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/guides/register-user"},"children":["here"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Requires a payload outlining the details of your Authorized Invoice. See more ",{"$$mdtype":"Tag","name":"OpenapiLink","attributes":{"link":"invoicing/openapi/invoice/authorizeinvoice","text":"here"},"children":[]},"."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"curl --location --request POST 'https://invoicing.staging.tilia-inc.com/v2/authorize/invoice' \\\n--header 'Content-Type: application/json' \\\n--header 'Authorization: Bearer CLIENT_CREDENTIALS_ACCESS_TOKEN' \\\n--data-raw '{\n   \"account_id\": \"USER_ACCOUNT_ID\",\n   \"is_escrow\": false,\n   \"invoice_mechanism\": \"api\",\n   \"reference_type\": \"My test order\",\n   \"reference_id\": \"123456789\",\n   \"line_items\": [\n       {\n         \"description\": \"Line item 1\",\n         \"product_sku\": \"ABC123\",\n         \"transaction_type\": \"user_to_integrator\",\n         \"currency\": \"USD\",\n         \"amount\": 1,\n         \"recipients\": []\n       },\n       {\n         \"description\": \"Line item 2\",\n         \"product_sku\": \"DEF456\",\n         \"transaction_type\": \"user_to_integrator\",\n         \"currency\": \"USD\",\n         \"amount\": 2,\n         \"recipients\": []\n       },\n       {\n         \"description\": \"Line item 3\",\n         \"product_sku\": \"GHI789\",\n         \"transaction_type\": \"user_to_integrator\",\n         \"currency\": \"USD\",\n         \"amount\": 3,\n         \"recipients\": []\n       }\n   ]\n}'\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example-response-payload","__idx":3},"children":["Example Response Payload"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n   \"status\": \"Success\",\n   \"message\": [],\n   \"codes\": [],\n   \"payload\": {\n       \"authorized_invoice_id\": \"AUTHORIZED_INVOICE_ID\",\n       \"password_token\": \"AUTHORIZED_USER_PASSWORD_TOKEN\"\n   }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your api should return the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["authorized_invoice_id"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["password_token"]}," to your client application to use in the Tilia SDK."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"swift-code-example","__idx":4},"children":["Swift Code Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let yourViewControllerForPresenting = UIViewController()\nTLManager.shared.setToken(\"AUTHORIZED_USER_PASSWORD_TOKEN\")\nTLManager.shared.presentCheckoutViewController(on: yourViewControllerForPresenting,\n                                               withInvoiceId: \"AUTHORIZED_INVOICE_ID\",\n                                               animated: true,\n                                               onUpdate: { onUpdate in print(onUpdate.description) },\n                                               onComplete: { onComplete in print(onComplete.description) },\n                                               onError: { onError in print(onError.description) })\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"demo-app-example","__idx":5},"children":["Demo App Example"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can see an example of the Checkout flow in our demo application.  See more ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/sdks/ios-demo-app"},"children":["here"]}]}]},"headings":[{"value":"Checkout (iOS SDK)","id":"checkout-ios-sdk","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":3},{"value":"Server-Side Code Example to create an Authorized Invoice and retrieve required information for the SDK","id":"server-side-code-example-to-create-an-authorized-invoice-and-retrieve-required-information-for-the-sdk","depth":4},{"value":"Example Response Payload","id":"example-response-payload","depth":4},{"value":"Swift Code Example","id":"swift-code-example","depth":3},{"value":"Demo App Example","id":"demo-app-example","depth":3}],"frontmatter":{"seo":{"title":"Checkout (iOS SDK)"}},"lastModified":"2026-02-05T18:12:30.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/sdks/ios-checkout","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}