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,

// You can find more detailed information at https://github.com/aplazame/ios-sdk/

paymentContext.checkAvailability(amount: 12050, currency: "EUR") { (status) in
  switch status {
    case .available:
      // Aplazame is available for this credit
    case .notAvailable:
      // Aplazame is not available for this credit. You should not display Aplazame as a payment method available
    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.

Inicio del checkout

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)")
  }
}

You can find more detailed information at https://github.com/aplazame/ios-sdk/