{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-ios/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["code-walkthrough","step"]},"type":"markdown"},"seo":{"title":"PaymentAction | iOS SDK Reference","description":"Parameter reference for the Finix iOS PaymentAction class — initializes and presents the payment sheet for securely collecting card and bank account details.","siteUrl":"https://docs.finix.com/","llmstxt":{"hide":false,"sections":[{"title":"Getting Started","includeFiles":["guides/getting-started/**/*.md"],"excludeFiles":[]},{"title":"Online Payments","includeFiles":["guides/online-payments/**/*.md"],"excludeFiles":["guides/online-payments/payment-features/fsa-hsa-non-healthcare-mcc.md"]},{"title":"In-Person Payments","includeFiles":["guides/in-person-payments/**/*.md"],"excludeFiles":[]},{"title":"Subscriptions","includeFiles":["guides/subscriptions/**/*.md"],"excludeFiles":[]},{"title":"After the Payment","includeFiles":["guides/after-the-payment/**/*.md"],"excludeFiles":[]},{"title":"Managing Operations","includeFiles":["guides/managing-operations/**/*.md"],"excludeFiles":[]},{"title":"Platform Payments","includeFiles":["guides/platform-payments/**/*.md"],"excludeFiles":[]},{"title":"Payouts","includeFiles":["guides/payouts/**/*.md"],"excludeFiles":[]},{"title":"Low-Code / No-Code","includeFiles":["low-code-no-code/**/*.md"],"excludeFiles":[]},{"title":"Developers","includeFiles":["additional-resources/developers/**/*.md"],"excludeFiles":[]},{"title":"Plugins","includeFiles":["additional-resources/plugins/**/*.md"],"excludeFiles":[]},{"title":"Industry Considerations","includeFiles":["guides/industry-considerations/**/*.md"],"excludeFiles":[]},{"title":"Regional Considerations","includeFiles":["guides/regional-considerations/**/*.md"],"excludeFiles":[]},{"title":"Release Notes","includeFiles":["release-notes/**/*.md"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"CodeWalkthrough","attributes":{"__idx":1,"filters":{},"filesets":[{"files":[{"path":"ios/online/_filesets/payment-action.swift","content":[{"start":0,"condition":{"steps":["signature"]},"children":["PaymentAction(","    credentials: credentials,","    delegate: self,","    configuration: configuration",")"]},"",{"start":8,"condition":{"steps":["param-credentials"]},"children":["// Sandbox","let credentials = FinixCredentials(","    applicationId: \"APgPDQrLD52TYvqazjHJJchM\",","    environment: .Sandbox",")","","// Production","let credentials = FinixCredentials(","    applicationId: \"APgPDQrLD52TYvqazjHJJchM\",","    environment: .Production",")"]},"",{"start":22,"condition":{"steps":["param-environment"]},"children":["// Sandbox — use a sandbox Application ID","let credentials = FinixCredentials(","    applicationId: \"APgPDQrLD52TYvqazjHJJchM\",","    environment: .Sandbox",")"]},"",{"start":30,"condition":{"steps":["param-delegate"]},"children":["extension CheckoutViewController: PaymentActionDelegate {","    @objc func didSucceed(paymentController: PaymentInputController, instrument: TokenResponse) {","        // instrument.id is the value you pass to the Finix API","        print(\"Token: \\(instrument.id)\")","        dismiss(animated: true)","    }","","    @objc func didCancel(paymentController: PaymentInputController) {","        dismiss(animated: true)","    }","","    @objc func didFail(paymentController: PaymentInputController, error: Error) {","        print(\"Error: \\(error.localizedDescription)\")","        dismiss(animated: true)","    }","}"]},"",{"start":49,"condition":{"steps":["presenting"]},"children":["class CheckoutViewController: UIViewController {","    var paymentAction: PaymentAction!","","    // Card payment sheet","    func showCardSheet() {","        let sheet = paymentAction.paymentSheet(style: .complete)","        paymentAction.present(from: self, paymentSheet: sheet, animated: true)","    }","","    // Bank account (ACH) payment sheet","    func showBankSheet() {","        let bankSheet = paymentAction.bankPaymentSheet()","        paymentAction.present(from: self, paymentSheet: bankSheet, animated: true)","    }","}"]},"",{"start":67,"condition":{"steps":["full-example"]},"children":["class CheckoutViewController: UIViewController {","    var paymentAction: PaymentAction!","","    override func viewDidLoad() {","        super.viewDidLoad()","","        let credentials = FinixCredentials(","            applicationId: \"APgPDQrLD52TYvqazjHJJchM\",","            environment: .Production","        )","        let config = Configuration(","            title: \"Card Entry\",","            branding: Branding(image: UIImage(named: \"MyLogo\"), title: \"My Company\"),","            buttonTitle: \"Pay Now\"","        )","        paymentAction = PaymentAction(","            credentials: credentials,","            delegate: self,","            configuration: config","        )","    }","","    func showPaymentSheet() {","        let sheet = paymentAction.paymentSheet(style: .complete)","        paymentAction.present(from: self, paymentSheet: sheet, animated: true)","    }","}","","extension CheckoutViewController: PaymentActionDelegate {","    @objc func didSucceed(paymentController: PaymentInputController, instrument: TokenResponse) {","        print(\"Token: \\(instrument.id)\")","        dismiss(animated: true)","    }","","    @objc func didCancel(paymentController: PaymentInputController) {","        dismiss(animated: true)","    }","","    @objc func didFail(paymentController: PaymentInputController, error: Error) {","        print(\"Error: \\(error.localizedDescription)\")","        dismiss(animated: true)","    }","}"]},""],"metadata":{"steps":["signature","param-credentials","param-environment","param-delegate","presenting","full-example"]},"basename":"payment-action.swift","language":"swift"}],"downloadAssociatedFiles":[]}],"steps":[{"id":"signature","heading":"Initializer"},{"id":"param-credentials","heading":"FinixCredentials"},{"id":"param-environment","heading":"environment"},{"id":"param-delegate","heading":"PaymentActionDelegate"},{"id":"presenting","heading":"paymentSheet(style:) / bankPaymentSheet() / present(from:paymentSheet:animated:)"},{"id":"full-example","heading":"Full example"}],"inputs":{},"toggles":{}},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"paymentaction","__idx":0},"children":["PaymentAction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The main entry point for displaying the payment sheet in your iOS app. Initialize ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentAction"]}," once in your view controller, then call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentSheet(style:)"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bankPaymentSheet()"]}," to create a sheet and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["present(from:paymentSheet:animated:)"]}," to display it modally."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["On successful tokenization, the delegate's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["didSucceed(paymentController:instrument:)"]}," method is called with a ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/ios/online/token-response"},"children":["TokenResponse"]},"."]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"signature","heading":"Initializer"},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"PaymentAction(\n    credentials: FinixCredentials,\n    delegate: PaymentActionDelegate,\n    configuration: Configuration? = nil\n)\n","lang":"swift"},"children":[]},{"$$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":"Parameter"},"children":["Parameter"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Required"},"children":["Required"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"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":["credentials"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FinixCredentials"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your Finix Application ID and environment. See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FinixCredentials"]}," below."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delegate"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentActionDelegate"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Yes"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Receives tokenization success and failure callbacks. See ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentActionDelegate"]}," below."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["configuration"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Configuration?"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["No"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Customize branding, sheet title, and button label. See ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/ios/online/configuration"},"children":["Configuration"]},"."]}]}]}]}]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"param-credentials","heading":"FinixCredentials"},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"FinixCredentials(\n    applicationId: String,\n    environment: FinixAPIEndpoint\n)\n","lang":"swift"},"children":[]},{"$$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":"Property"},"children":["Property"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"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":["applicationId"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["String"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Your Finix Application ID, found in the Finix Dashboard."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["environment"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FinixAPIEndpoint"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".Sandbox"]}," for testing, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".Production"]}," for live payments."]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Application IDs are environment-specific — use the one that matches your chosen ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["environment"]}," value."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"param-environment","heading":"environment"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Controls which Finix environment the SDK connects to."]},{"$$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":"Value"},"children":["Value"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Environment"},"children":["Environment"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".Sandbox"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sandbox"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".Production"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Production"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["applicationId"]}," must belong to the same environment."]}]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"param-delegate","heading":"PaymentActionDelegate"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Implement ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PaymentActionDelegate"]}," to receive tokenization results."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"@objc func didSucceed(paymentController: PaymentInputController, instrument: TokenResponse)\n@objc func didCancel(paymentController: PaymentInputController)\n@objc func didFail(paymentController: PaymentInputController, error: Error)\n","lang":"swift"},"children":[]},{"$$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":"Method"},"children":["Method"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Trigger"},"children":["Trigger"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Receives"},"children":["Receives"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["didSucceed(paymentController:instrument:)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Successful tokenization"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"/ios/online/token-response"},"children":["TokenResponse"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["didCancel(paymentController:)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["User dismissed the sheet"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["—"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["didFail(paymentController:error:)"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Tokenization failed"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Error"]}]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After receiving ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["didSucceed"]},", pass ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["instrument.id"]}," to your backend and call the Finix API to create a Payment Instrument."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"presenting-the-payment-sheet","__idx":1},"children":["Presenting the Payment Sheet"]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"presenting","heading":"paymentSheet(style:) / bankPaymentSheet() / present(from:paymentSheet:animated:)"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a payment sheet for the desired collection type, then present it modally."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For card collection, call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["paymentSheet(style:)"]}," with a ",{"$$mdtype":"Tag","name":"a","attributes":{"href":"/ios/online/form-styles"},"children":["Form Style"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let sheet = paymentAction.paymentSheet(style: .complete)\npaymentAction.present(from: self, paymentSheet: sheet, animated: true)\n","lang":"swift"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For bank account (ACH) collection, call ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["bankPaymentSheet()"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"swift","header":{"controls":{"copy":{}}},"source":"let bankSheet = paymentAction.bankPaymentSheet()\npaymentAction.present(from: self, paymentSheet: bankSheet, animated: true)\n","lang":"swift"},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"full-example","__idx":2},"children":["Full example"]},{"$$mdtype":"Tag","name":"CodeStep","attributes":{"id":"full-example","heading":"Full example"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["A complete implementation with credentials, delegate conformance, and optional configuration."]}]}]}]},"headings":[{"value":"PaymentAction","id":"paymentaction","depth":1},{"value":"Presenting the Payment Sheet","id":"presenting-the-payment-sheet","depth":2},{"value":"Full example","id":"full-example","depth":2}],"frontmatter":{"seo":{"title":"PaymentAction | iOS SDK Reference","description":"Parameter reference for the Finix iOS PaymentAction class — initializes and presents the payment sheet for securely collecting card and bank account details."},"markdown":{"toc":{"hide":true}},"footer":{"hide":true}},"lastModified":"2026-08-28T19:53:05.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ios/online/payment-action","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}