CoinflowCardForm is a SwiftUI SDK that embeds Coinflow’s card tokenization form directly into iOS apps. The user enters their card inside your app, the SDK returns a payment token, and your backend charges the card via the standard Coinflow checkout API.
coinflow-swift0.2.0In Xcode: File → Add Package Dependencies… and enter:
Select version 0.2.0 (or “Up to Next Major”), then add the CoinflowCardForm library product to your app target.
Drop CoinflowCardFormView into your SwiftUI layout and pass a CardFormCoordinator you’ll use to trigger tokenization.
your-merchant-id is an example placeholder. Use your actual merchant ID from the merchant dashboard, or contact the Coinflow integrations team. Typically you’d inject it via a build setting or environment variable rather than hard-coding it.
Switch env based on build configuration:
.sandbox — test cards, no real money.prod — live cards, real moneycoordinator.tokenize() returns a TokenizeResponse:
token: String — payment token to send to your backendexpMonth: String?, expYear: String? — populated only for variants that collect expirySend the token to your server and call Coinflow’s checkout API to charge it. See the Checkout API reference for the full request shape.
MerchantTheme styles the rendered form. All fields optional.
The hosted form reflows responsively — at narrow widths the inputs wrap to multiple rows. To keep your SwiftUI container fitted, observe coordinator.contentHeight and bind it to your frame:
contentHeight is @Published on CardFormCoordinator and updates whenever the form reflows. Without this wiring the form may be clipped if it wraps.