The Finix iOS SDK lets you securely collect card and bank account details in your iOS app using a pre-built payment sheet. Payment data is tokenized before it reaches your application, keeping sensitive card data out of your code and ensuring PCI compliance.
Tokens are created in Finix's vault and returned to your app. Use the token immediately to create a Payment Instrument via the Finix API.
Tokens expire 30 minutes after creation. Create a Payment Instrument as soon as you receive the token.
The library is distributed via CocoaPods. Add it to your Podfile:
pod 'FinixPaymentSheet', :git => 'https://github.com/finix-payments/FinixPaymentSheet.git', :tag => 'v1.0.10'Then run:
pod installAfter installation, import the SDK in your source files:
import FinixPaymentSheetNo bridging headers or additional configuration are required.
| Requirement | Value |
|---|---|
| iOS | 12.0+ |
| Xcode | 14.0+ |
| Swift | 5.8+ |
Initialize FinixCredentials, create a PaymentAction, present a payment sheet, and handle the token response via the delegate.
class CheckoutViewController: UIViewController {
var paymentAction: PaymentAction!
override func viewDidLoad() {
super.viewDidLoad()
let credentials = FinixCredentials(
applicationId: "YOUR_APPLICATION_ID",
environment: .Sandbox // set to .Production for production
)
paymentAction = PaymentAction(credentials: credentials, delegate: self)
}
func showPaymentSheet() {
let sheet = paymentAction.paymentSheet(style: .complete)
paymentAction.present(from: self, paymentSheet: sheet, animated: true)
}
}
extension CheckoutViewController: PaymentActionDelegate {
func paymentAction(_ action: PaymentAction, didSucceedWith response: TokenResponse) {
// response.id — use this to create a Payment Instrument via the Finix API
print("Token: \(response.id)")
}
func paymentAction(_ action: PaymentAction, didFailWith error: Error) {
print("Error: \(error.localizedDescription)")
}
}