{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["json-schema"]},"type":"markdown"},"seo":{"title":"Start Transaction","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":["openapi"],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"start-transaction","__idx":0},"children":["Start Transaction"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"taptopaysdkstarttransactionactivity-transactionrequest","__idx":1},"children":["tapToPaySdk.startTransaction(activity, transactionRequest)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionRequest"]}," and invoke ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tapToPaySdk.startTransaction()"]}," to start a payment or refund."," ","Transaction results will be received in the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onTransactionResult"]}," callback passed to ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/android/sdk/init-sdk#taptopaysdkregistertransactionresulthandleractivity-ontransactionresult"},"children":["tapToPaySdk.registerTransactionResultHandler()"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"@Throws(InvalidTransactionParamException::class)\nfun startTransaction(\n    activity: ComponentActivity,\n    transactionRequest: TransactionRequest\n)\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"throws-invalidtransactionparamexception-exception","__idx":2},"children":["Throws InvalidTransactionParamException Exception"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["It is strongly recommended to handle any exceptions thrown by ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["tapToPaySdk.startTransaction()"]}," otherwise your App will crash."," ","Throws ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["InvalidTransactionParamException"]}," when one of the following conditions is not met."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amountInCents"]}," must be positive and non zero"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["amountInCents"]}," must be less than 10,000,000 ($100,000.00)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reference"]}," must not be blank"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters","__idx":3},"children":["Parameters"]},{"$$mdtype":"Tag","name":"JsonSchema","attributes":{"schema":{"type":"object","properties":{"activity":{"type":"ComponentActivity","description":"The Android Activity"},"transactionRequest":{"type":"TransactionRequest","description":"The request parameters for the transaction."}},"required":["activity","transactionRequest"]},"options":{"schemaExpansionLevel":1},"schemaResolved":{"openapi":"3.1.0","components":{"schemas":{"__root":{"type":"object","properties":{"activity":{"type":"ComponentActivity","description":"The Android Activity"},"transactionRequest":{"type":"TransactionRequest","description":"The request parameters for the transaction."}},"required":["activity","transactionRequest"]}}}},"schemaResolvedErrors":[]},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"transactionrequest","__idx":4},"children":["TransactionRequest"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Request parameters for the transaction. This determines if the transaction is a purchase or refund."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PosInfo"]}," must be set via ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["sdk.setPosInfo(posInfo)"]}," or in this function otherwise an error will be thrown. See ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/in-person-payments/tap-to-pay/android/sdk/pos-info"},"children":["PosInfo"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"kotlin","header":{"controls":{"copy":{}}},"source":"@Parcelize\ndata class TransactionRequest(\n    val type: TransactionType,\n    val amountInCents: Int,\n    val reference: String,\n    var posInfo: PosInfo? = null,\n) : Parcelable\n","lang":"kotlin"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"parameters-1","__idx":5},"children":["Parameters"]},{"$$mdtype":"Tag","name":"JsonSchema","attributes":{"schema":{"type":"object","properties":{"type":{"type":"TransactionType","description":"The type of transaction","enum":["PURCHASE","REFUND"]},"amountInCents":{"type":"Int","description":"The amount in cents."},"reference":{"type":"String","description":"The identifier for the transaction and MUST be unique."},"posInfo":{"type":"PosInfo","description":"Optionally provide the PosInfo per transaction. PosInfo must be provided via this parameter or in sdk.setPosInfo() otherwise an error will be thrown."}},"required":["type","amountInCents","reference"]},"options":{"schemaExpansionLevel":1},"schemaResolved":{"openapi":"3.1.0","components":{"schemas":{"__root":{"type":"object","properties":{"type":{"type":"TransactionType","description":"The type of transaction","enum":["PURCHASE","REFUND"]},"amountInCents":{"type":"Int","description":"The amount in cents."},"reference":{"type":"String","description":"The identifier for the transaction and MUST be unique."},"posInfo":{"type":"PosInfo","description":"Optionally provide the PosInfo per transaction. PosInfo must be provided via this parameter or in sdk.setPosInfo() otherwise an error will be thrown."}},"required":["type","amountInCents","reference"]}}}},"schemaResolvedErrors":[]},"children":[]}]},"headings":[{"value":"Start Transaction","id":"start-transaction","depth":1},{"value":"tapToPaySdk.startTransaction(activity, transactionRequest)","id":"taptopaysdkstarttransactionactivity-transactionrequest","depth":2},{"value":"Throws InvalidTransactionParamException Exception","id":"throws-invalidtransactionparamexception-exception","depth":3},{"value":"Parameters","id":"parameters","depth":3},{"value":"TransactionRequest","id":"transactionrequest","depth":2},{"value":"Parameters","id":"parameters-1","depth":3}],"frontmatter":{"title":"Start Transaction","seo":{"title":"Start Transaction"}},"lastModified":"2026-09-02T01:02:13.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/in-person-payments/tap-to-pay/android/sdk/start-transaction","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}