Swift Package Manager
Em File → Add Packages… , adiciona o repositório da FaciPay e escolhe os produtos
FaciPay (umbrella), ou FaciPayCore + FaciPayUI separadamente.
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
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
Configura cedo (ex.: no AppDelegate/App). O ambiente é detetado pelo prefixo da chave.
import FaciPay
// async/await
try await FaciPay. configure (
publishableKey : "pk_test_xxx" ,
config : FaciPayConfig (
language : . portuguese ,
theme : . light ,
allowedPaymentMethods : [. mcxExpress , . reference ]
)
)
// 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.
Próximo passo: Checkout Apresentar um pagamento.