{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","openapiLink"]},"type":"markdown"},"seo":{"title":"Tutorial: Make standard transactions with royalties","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":"tutorial-make-standard-transactions-with-royalties","__idx":0},"children":["Tutorial: Make standard transactions with royalties"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this tutorial, you demonstrate the interactions that support paying the creators of digital goods"," ","a royalty or a commission for purchases made in your marketplace."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Allow about 10 minutes to complete this tutorial."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/tutorial-user-to-user-token-royalty-transaction.9f1de28cefde659f7575fc77706ee52e499bf9ca4e98f702e82765c780800535.9c1bb791.png","alt":"Diagram of roayalty use case interactions"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To pay creators a royalty or to pay a vendor a commission on a sale, you divide the line-item values"," ","between the creator or vendor and the seller (recipient) when you create the transaction's invoice."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["While this tutorial demonstrates a transaction that has only two recipients: the recipient and the creator,"," ","Tila transactions can have more recipients. For example, a recipient, and several creators;"," ","a recipient, a vendor, and several creators, and so on."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The exercises in this tutorial start after the user selects items in the application."," ","The application then retrieves the account and wallet information about the recipients"," ","and the creators who receive the royalties."," ","An application might get these details from a catalog listing, for example."," ","The payer's account and wallet information is also retrieved from the system to combine with the other"," ","information to create the transaction's invoice."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A new invoice for a user-to-user, transaction that's using tokens needs"," ","at least the following information:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Product information that describes what's being exchanged for tokens"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Payer's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["account_id"]},": from the paying user's account information"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source_wallet_id"]},": the wallet ID of the payer's wallet"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_account_id"]},": the recipient's account ID, retrieved from the recipient or catalog."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_wallet_id"]},": for both users to receive the tokens from the sale: the recipient's wallet and the creator's wallet."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In an actual implementation, the application provides this information, so it's simulated in this tutorial."," ","The product information is part of the demonstration and the users are identified by their usernames."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"api-operations-in-this-tutorial","__idx":1},"children":["API operations in this tutorial"]},{"$$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":{"align":"left","data-label":"Tutorial interaction"},"children":["Tutorial interaction"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Tilia APIs used"},"children":["Tilia APIs used"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Scope"},"children":["Scope"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#create-a-user-to-user-invoice"},"children":["Create a user-to-user invoice"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"OpenapiLink","attributes":{"link":"invoicing/openapi/invoice/createinvoice","text":"Create a new invoice"},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["write_invoices"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"#pay-a-user-to-user-invoice"},"children":["Pay a user-to-user-invoice"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"OpenapiLink","attributes":{"link":"invoicing/openapi/invoice/payinvoice","text":"Pay invoice"},"children":[]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["write_invoices"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"to-complete-this-tutorial","__idx":2},"children":["To complete this tutorial"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This tutorial uses the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore Tilia transactions"]}," collection from the"," ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://www.postman.com/tilia-docs-testing/workspace/get-started-using-tilia-services/overview"},"children":["shared Postman workspace"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To complete this tutorial successfully:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure the software described in ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/tutorial_get_started"},"children":["Get started with the tutorials"]}," ","has been installed on your system and configured."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure that you have initialized the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tilia Client Info"]}," environment variables by running the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/user-accounts"},"children":["User account tutorials"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In Postman:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Open the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tilia tutorial workspace"]}," you created in ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/tutorial_get_started"},"children":["Get started with the tutorials"]}," for this tutorial."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure you have the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore Tilia transactions"]}," collection forked to your ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tilia tutorial workspace"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Make sure that you've selected the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tilia Client Info"]}," environment and confirmed that it has:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your Tilia developer credentials."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All of the user-related environment variables with ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Current values"]}," defined."]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In your ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Tilia tutorial workspace"]},", open the list of ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Collections"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the list of ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Collections"]},", expand the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore Tilia transactions"]}," collection."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If it's been more than an hour since you last got an access token for this collection,"," ","get a new one as described in ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/transactions#get-an-access-token"},"children":["Tutorial: Transactions overview"]},","," ","and then return to continue here."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"create-a-user-to-user-invoice","__idx":3},"children":["Create a user-to-user invoice"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this exercise, the invoice and line-item data is assembled into the"," ","following object to send in the request body."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A summary description of the invoice"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The product information"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["payer's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["account_id"]},": from the paying user's account information"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source_wallet_id"]},": the wallet ID of the payer's wallet."," ","If omitted, the default wallet for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["account_id"]}," is used."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For each of the recipient and the creator:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_account_id"]},": the recipient or creator's account ID, retrieved from the recipient or catalog."," ","If this property is used, the default wallet is used."," ","If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_account_id"]}," is used, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_wallet_id"]}," can be omitted."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_wallet_id"]},": the recipient or creator's wallet to receive the tokens from the sale."," ","This is the value used in this exercise."," ","If ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_wallet_id"]}," is used, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["destination_account_id"]}," can be omitted."]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"account_id\": \"{{payers_account_id}}\",\n    \"description\": \"Digital product order\",\n    \"line_items\": [\n      {\n        \"amount\": 20000,\n        \"currency\": \"TIL\",\n        \"transaction_type\": \"user_to_user\",\n        \"description\": \"In-game digital bundle\",\n        \"recipients\": [\n          {\n            \"amount\": 18000,\n            \"currency\": \"TIL\",\n            \"source_wallet_id\": \"{{payers_wallet_id}}\",\n            \"destination_wallet_id\": \"{{recipients_wallet_id}}\"\n          },\n          {\n            \"amount\": 2000,\n            \"currency\": \"TIL\",\n            \"source_wallet_id\": \"{{payers_wallet_id}}\",\n            \"destination_wallet_id\": \"{{creators_wallet_id}}\"\n          }\n        ]\n      }\n    ]\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To send this information and create a new user-to-user invoice, in Postman:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore Tilia transactions"]}," collection, in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Transaction with royalties"]}," folder,"," ","open the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create a user-to-user invoice"]}," request."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the request ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Body"]}," field, notice the invoice information described previously."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Create a user-to-user invoice"]}," request, choose ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Send"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After the response returns, open the response ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Body"]}," tab below the request to review the response body details."]}]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":["Show a typical response body with the transaction info."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"status\": \"Success\",\n    \"message\": [],\n    \"codes\": [],\n    \"payload\": {\n        \"invoice_id\": \"107ea48f-ef24-4b51-a954-dfc4ad6677cd\",\n        \"account_id\": \"acct_2b5iunvHmd2OjEci7xFzDUGHOKF\",\n        \"invoice_type\": \"user_purchase_virtual\",\n        \"reference_type\": \"\",\n        \"reference_id\": \"\",\n        \"state\": \"OPEN\",\n        \"description\": \"Digital product order\",\n        \"metadata\": {},\n        \"summary\": {\n            \"total_amount\": 20000,\n            \"total_amount_usd\": 200,\n            \"currency\": \"TIL\",\n            \"display_amount\": \"TIL20000\",\n            \"subtotal\": {\n                \"total_amount\": 20000,\n                \"total_amount_usd\": 200,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL20000\"\n            },\n            \"tax\": {\n                \"total_amount\": 0,\n                \"total_amount_usd\": 0,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL 0.00\"\n            },\n            \"payment_breakdown\": [],\n            \"tax_calculation\": \"\",\n            \"is_tax_exempt\": false\n        },\n        \"failure_code\": \"\",\n        \"failure_reason\": \"\",\n        \"created\": \"0001-01-01T00:00:00Z\",\n        \"updated\": \"0001-01-01T00:00:00Z\",\n        \"payment_methods\": {\n            \"f9c7cf00-1301-4bea-ab34-980633992145\": {\n                \"provider\": \"wallet\",\n                \"payment_method_id\": \"f9c7cf00-1301-4bea-ab34-980633992145\",\n                \"authorized_amount\": 20000,\n                \"currency\": \"TIL\",\n                \"display_string\": \"Standard TIL Ledger\",\n                \"display_amount\": \"TIL20000\",\n                \"tags\": {\n                    \"standard\": {\n                        \"tag_id\": \"\",\n                        \"tag\": \"\"\n                    }\n                },\n                \"subitems\": {\n                    \"49877cd8-caa0-4a8a-b058-9061e4382410\": {\n                        \"subitem_id\": \"49877cd8-caa0-4a8a-b058-9061e4382410\",\n                        \"amount\": 0,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL0\",\n                        \"reference_type\": \"\",\n                        \"reference_id\": \"\",\n                        \"subitem_type\": \"standard_virtual_payment\",\n                        \"description\": \"\",\n                        \"metadata\": {\n                            \"pm_display_string\": \"Standard TIL Ledger\"\n                        },\n                        \"source_account_id\": \"acct_2b5iunvHmd2OjEci7xFzDUGHOKF\",\n                        \"source_payment_method_id\": \"f9c7cf00-1301-4bea-ab34-980633992145\",\n                        \"source_wallet_id\": \"7a2b65bf-cbcc-4157-a83c-3ecd2a6629c9\",\n                        \"destination_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"87a494bc-f648-4dcd-b0fc-e59106e0598f\",\n                        \"tags\": null\n                    }\n                }\n            }\n        },\n        \"line_items\": {\n            \"3092d703-bb42-4720-81ef-ddb6e0811945\": {\n                \"line_item_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                \"product_sku\": \"\",\n                \"product_code\": \"\",\n                \"amount\": 20000,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL20000\",\n                \"reference_type\": \"\",\n                \"reference_id\": \"\",\n                \"transaction_type\": \"user_to_user_virtual\",\n                \"description\": \"In-game digital bundle\",\n                \"metadata\": null,\n                \"tags\": null,\n                \"sort_order\": 0,\n                \"subitems\": {\n                    \"cbf37961-043e-4814-b0cb-92cd5c7fd6c7\": {\n                        \"subitem_id\": \"cbf37961-043e-4814-b0cb-92cd5c7fd6c7\",\n                        \"amount\": 2000,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL2000\",\n                        \"reference_type\": \"invoicing.invoice_line_item_v2.line_item_id\",\n                        \"reference_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                        \"subitem_type\": \"user_recipient_virtual\",\n                        \"description\": \"\",\n                        \"metadata\": null,\n                        \"source_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"source_payment_method_id\": \"\",\n                        \"source_wallet_id\": \"41f5e46b-76ef-4bf8-b661-d5fb30159713\",\n                        \"destination_account_id\": \"acct_2b5iv4wMRe6BrhMjM00SQYR70lh\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"45ae2ff6-8803-4f15-9cfa-135ba4a06dee\",\n                        \"tags\": null\n                    },\n                    \"d571d9f3-4bc2-4913-a8ad-28e71219672d\": {\n                        \"subitem_id\": \"d571d9f3-4bc2-4913-a8ad-28e71219672d\",\n                        \"amount\": 18000,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL18000\",\n                        \"reference_type\": \"invoicing.invoice_line_item_v2.line_item_id\",\n                        \"reference_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                        \"subitem_type\": \"user_recipient_virtual\",\n                        \"description\": \"\",\n                        \"metadata\": null,\n                        \"source_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"source_payment_method_id\": \"\",\n                        \"source_wallet_id\": \"41f5e46b-76ef-4bf8-b661-d5fb30159713\",\n                        \"destination_account_id\": \"acct_2b5iuyTGOvKOnu0q9SzlaKlco2G\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"f885a836-e9cf-409f-b24c-9318d12ca596\",\n                        \"tags\": null\n                    }\n                }\n            }\n        },\n        \"subitems\": {},\n        \"tags\": null\n    }\n}\n","lang":"json"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payload.state"]}," property, which has a value of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["OPEN"]},", indicates the status of the transaction."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Notice that the invoice data returned in the response body includes many more properties"," ","than were sent in the request."," ","For more information about what you can include when creating an invoice,"," ","review ",{"$$mdtype":"Tag","name":"OpenapiLink","attributes":{"link":"invoicing/openapi/invoice/createinvoice","text":"Create a new invoice"},"children":[]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"pay-a-user-to-user-invoice","__idx":4},"children":["Pay a user-to-user-invoice"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In this exercise, you pay the invoice created in the previous exercise."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The preceding exercise only creates an invoice in Tilila's system."," ","No tokens have moved, yet."," ","This task moves the payer's tokens to the wallets of the recipient and creator as the invoice describes."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["To pay the invoice, in Postman:"]}]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Explore Tilia transactions"]}," collection, in the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Transaction with royalties"]}," folder,"," ","open the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Pay a user-to-user-invoice"]}," request."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["URL"]}," field, notice that the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["invoice_id"]}," returned by the preceding request is used to identify the invoice to pay."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Pay a user-to-user-invoice"]}," request, choose ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Send"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After the response returns, open the response ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Body"]}," tab below the request to review the response body details."]}]}]},{"$$mdtype":"Tag","name":"details","attributes":{},"children":[{"$$mdtype":"Tag","name":"summary","attributes":{},"children":["Show a typical response body with the payment info."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"status\": \"Success\",\n    \"message\": [],\n    \"codes\": [],\n    \"payload\": {\n        \"invoice_id\": \"107ea48f-ef24-4b51-a954-dfc4ad6677cd\",\n        \"account_id\": \"acct_2b5iunvHmd2OjEci7xFzDUGHOKF\",\n        \"invoice_type\": \"user_purchase_virtual\",\n        \"reference_type\": \"\",\n        \"reference_id\": \"\",\n        \"state\": \"SUCCESS\",\n        \"description\": \"Digital product order\",\n        \"metadata\": {},\n        \"summary\": {\n            \"total_amount\": 20000,\n            \"total_amount_usd\": 200,\n            \"currency\": \"TIL\",\n            \"display_amount\": \"TIL20000\",\n            \"subtotal\": {\n                \"total_amount\": 20000,\n                \"total_amount_usd\": 200,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL20000\"\n            },\n            \"tax\": {\n                \"total_amount\": 0,\n                \"total_amount_usd\": 0,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL 0.00\"\n            },\n            \"payment_breakdown\": [],\n            \"tax_calculation\": \"\",\n            \"is_tax_exempt\": false\n        },\n        \"failure_code\": \"\",\n        \"failure_reason\": \"\",\n        \"created\": \"2024-01-19T18:55:18Z\",\n        \"updated\": \"2024-01-19T18:55:18Z\",\n        \"payment_methods\": {\n            \"f9c7cf00-1301-4bea-ab34-980633992145\": {\n                \"provider\": \"wallet\",\n                \"payment_method_id\": \"f9c7cf00-1301-4bea-ab34-980633992145\",\n                \"authorized_amount\": 20000,\n                \"currency\": \"TIL\",\n                \"display_string\": \"\",\n                \"display_amount\": \"TIL20000\",\n                \"tags\": null,\n                \"subitems\": {\n                    \"49877cd8-caa0-4a8a-b058-9061e4382410\": {\n                        \"subitem_id\": \"49877cd8-caa0-4a8a-b058-9061e4382410\",\n                        \"amount\": 20000,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL20000\",\n                        \"reference_type\": \"payments.payment.id\",\n                        \"reference_id\": \"755f3307-0be7-4f06-a43e-7bd472d6b091\",\n                        \"subitem_type\": \"standard_virtual_payment\",\n                        \"description\": \"\",\n                        \"metadata\": {\n                            \"pm_display_string\": \"Standard TIL Ledger\"\n                        },\n                        \"source_account_id\": \"acct_2b5iunvHmd2OjEci7xFzDUGHOKF\",\n                        \"source_payment_method_id\": \"f9c7cf00-1301-4bea-ab34-980633992145\",\n                        \"source_wallet_id\": \"7a2b65bf-cbcc-4157-a83c-3ecd2a6629c9\",\n                        \"destination_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"87a494bc-f648-4dcd-b0fc-e59106e0598f\",\n                        \"tags\": null\n                    }\n                }\n            }\n        },\n        \"line_items\": {\n            \"3092d703-bb42-4720-81ef-ddb6e0811945\": {\n                \"line_item_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                \"product_sku\": \"\",\n                \"product_code\": \"\",\n                \"amount\": 20000,\n                \"currency\": \"TIL\",\n                \"display_amount\": \"TIL20000\",\n                \"reference_type\": \"\",\n                \"reference_id\": \"\",\n                \"transaction_type\": \"user_to_user_virtual\",\n                \"description\": \"In-game digital bundle\",\n                \"metadata\": null,\n                \"tags\": null,\n                \"sort_order\": 0,\n                \"subitems\": {\n                    \"cbf37961-043e-4814-b0cb-92cd5c7fd6c7\": {\n                        \"subitem_id\": \"cbf37961-043e-4814-b0cb-92cd5c7fd6c7\",\n                        \"amount\": 2000,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL2000\",\n                        \"reference_type\": \"invoicing.invoice_line_item_v2.line_item_id\",\n                        \"reference_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                        \"subitem_type\": \"user_recipient_virtual\",\n                        \"description\": \"\",\n                        \"metadata\": null,\n                        \"source_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"source_payment_method_id\": \"\",\n                        \"source_wallet_id\": \"41f5e46b-76ef-4bf8-b661-d5fb30159713\",\n                        \"destination_account_id\": \"acct_2b5iv4wMRe6BrhMjM00SQYR70lh\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"45ae2ff6-8803-4f15-9cfa-135ba4a06dee\",\n                        \"tags\": null\n                    },\n                    \"d571d9f3-4bc2-4913-a8ad-28e71219672d\": {\n                        \"subitem_id\": \"d571d9f3-4bc2-4913-a8ad-28e71219672d\",\n                        \"amount\": 18000,\n                        \"currency\": \"TIL\",\n                        \"display_amount\": \"TIL18000\",\n                        \"reference_type\": \"invoicing.invoice_line_item_v2.line_item_id\",\n                        \"reference_id\": \"3092d703-bb42-4720-81ef-ddb6e0811945\",\n                        \"subitem_type\": \"user_recipient_virtual\",\n                        \"description\": \"\",\n                        \"metadata\": null,\n                        \"source_account_id\": \"75452177-cad5-42bd-8530-4fb86ecc6fa9\",\n                        \"source_payment_method_id\": \"\",\n                        \"source_wallet_id\": \"41f5e46b-76ef-4bf8-b661-d5fb30159713\",\n                        \"destination_account_id\": \"acct_2b5iuyTGOvKOnu0q9SzlaKlco2G\",\n                        \"destination_payment_method_id\": \"\",\n                        \"destination_wallet_id\": \"f885a836-e9cf-409f-b24c-9318d12ca596\",\n                        \"tags\": null\n                    }\n                }\n            }\n        },\n        \"subitems\": {},\n        \"tags\": null\n    }\n}\n","lang":"json"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The invoice returned in the response buffer shows the invoice as paid in the value"," ","of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["payload.state"]},", which is now ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["SUCCESS"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"next-steps","__idx":5},"children":["Next steps"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The exercises in this tutorial used Postman to call the Tilia APIs."," ","For an example of how to integrate the transaction demonstrated in this tutorial into a web page,"," ","see ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/guides/multi-seller-transaction"},"children":["Multi-Seller Purchase"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If you're curious, you can review the wallet balances of the users involved in this transaction by using the exercises in the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/transactions/tutorial_txn_info"},"children":["Get info about transactions"]}," tutorial."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can also return to the ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/tutorials/transactions"},"children":["Transaction tutorials overview"]}," and find another transaction tutorial, or just go to the next transaction tutorial."]}]},"headings":[{"value":"Tutorial: Make standard transactions with royalties","id":"tutorial-make-standard-transactions-with-royalties","depth":1},{"value":"API operations in this tutorial","id":"api-operations-in-this-tutorial","depth":3},{"value":"To complete this tutorial","id":"to-complete-this-tutorial","depth":2},{"value":"Create a user-to-user invoice","id":"create-a-user-to-user-invoice","depth":2},{"value":"Pay a user-to-user-invoice","id":"pay-a-user-to-user-invoice","depth":2},{"value":"Next steps","id":"next-steps","depth":2}],"frontmatter":{"seo":{"title":"Tutorial: Make standard transactions with royalties"}},"lastModified":"2026-02-05T18:12:30.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/tutorials/transactions/tutorial_txn_royalties","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}