SDK iOS
Integration
// Check https://github.com/aplazame/ios-sdk/ for more detailed documentation
let config = APZConfig(accessToken: "api_public_key", environment: .sandbox)
let paymentContext = APZPaymentContext(config: config)
Check availability
To display the payment button with Aplazame based on the limits set in your account,
// Check https://github.com/aplazame/ios-sdk/ for more detailed documentation
paymentContext.checkAvailability(amount: 12050, currency: "EUR") { (status) in
switch status {
case .available:
// Aplazame is available for this checkout
case .notAvailable:
// Aplazame is not available for this checkout. You should not show Aplazame as an available payment method.
case .undefined:
// An error has occurred
}
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| selector | css selector | No | CSS selector to display/hide Aplazame’s payment method. |
| amount | decimal | Yes | Quantity to be financed. |
| currency | ISO 4217 | Yes | The currency code of the order. |
Checkout start
Here you can see how to integrate the SDK
// Start activity indicator
paymentContext.requestCheckout(checkout: checkout, delegate: self, onReady: { vc in
// Stop activity indicator
self.navigationController?.pushViewController(vc, animated: true)
})
Show result
extension ViewController: APZPaymentContextDelegate {
func checkoutDidClose(checkoutVC: UIViewController, with reason: APZCheckoutCloseReason) {
print("checkoutDidCloseWithReason \(reason.rawValue)")
checkoutVC.dismiss(animated: true, completion: nil)
}
func checkoutStatusChanged(with status: APZCheckoutStatus) {
print("checkoutStatusChanged \(status.rawValue)")
}
}
info
You can find more detailed information at https://github.com/aplazame/ios-sdk/