# Instalação
Adicionar a FaciPay iOS SDK via Swift Package Manager ou CocoaPods.
## Swift Package Manager
Em **File → Add Packages…**, adicione o repositório da FaciPay e escolha os produtos
`FaciPay` (umbrella), ou `FaciPayCore` + `FaciPayUI` separadamente.
```swift Package.swift
dependencies: [
.package(url: "https://github.com/faciconnect/facipay-ios", from: "1.0.0")
],
targets: [
.target(name: "App", dependencies: [
.product(name: "FaciPay", package: "facipay-ios")
])
]
```
## CocoaPods
```ruby Podfile
pod 'FaciPay', '~> 1.0.0'
# ou, modular:
# pod 'FaciPayCore', '~> 1.0.0'
# pod 'FaciPayUI', '~> 1.0.0'
```
Os módulos: **FaciPayCore** (lógica, sem UI) e **FaciPayUI** (SwiftUI/UIKit). O `FaciPay`
inclui ambos. XCFrameworks também em `cdn.faciconnect.com/sdks/ios/v1.0.0/`.
## Configuração
Configure cedo (ex.: no `AppDelegate`/`App`). O ambiente é detetado pelo prefixo da chave.
```swift
import FaciPay
// async/await
try await FaciPay.configure(
publishableKey: "pk_test_xxx",
config: FaciPayConfig(
language: .portuguese,
theme: .light,
allowedPaymentMethods: [.mcxExpress, .reference, .facipay]
)
)
// callback (UIKit)
FaciPay.configure(publishableKey: "pk_test_xxx", config: FaciPayConfig()) { result in
switch result {
case .success: break
case .failure(let error): print(error.localizedDescription)
}
}
```
A app usa apenas a `publishableKey`. O `clientSecret` e o `webhookSecret` vivem só no backend.
Apresentar um pagamento.