To implement the iOS Payment Links SDK for Native iOS, include the following callback methods:
MethodDescriptionArgumentType
onInitializedTriggered when SDK initialization was successful.
onInitializeFailedTriggered when SDK initialization failed.errorACErrorMessage
onPricePointsSuccessTriggered when the price points have successfully been retrieved.pricePointsPricePoints
onPricePointsFailedTriggered when price points can’t be retrieved or are unavailable.errorACErrorMessage
onPurchaseSuccessTriggered when a purchase was successful.orderOrderResponseModel
onPurchaseFailedTriggered when the checkout window closed or if a server to server error occurred during the purchasing process. Returns a unique integer error code, a detailed message, and a raw JSON string (if available) with more details.errorACErrorMessage
onAwardTriggered when the award action is either successful or has failed. The award argument indicates whether the action was a success or a failure.successBool
onNoneAwardedSuccessTriggered when the noneAwarded action was successful. The noneAwarded argument contains a list of orders to award.orderIds[String]
onNoneAwardedFailedTriggered when the noneAwarded action was failed.errorACErrorMessage
The OrderResponseModel argument contains the following properties:
Property NameTypeDescriptionExample
dateIntUnix timestamp of the order.1718182312
sessionTokenStringUnique token for the current session."xxxxXXXXxxxxXXXXxxxx"
offerNameStringName of the purchased offer."Starter Pack"
offerSkuStringSKU identifier for the offer."starter_pack_001"
items[Item]List of items included in the purchase.[{ name: "Gems", sku: "gem_01", quantity: "100" }]
items.nameStringDisplay name of the item."Gems"
items.skuStringUnique SKU code for the item."gem_01"
items.quantityStringQuantity of the item included."100"
priceIntPrice of the order in minor units. For example, cents for USD.499
currencyStringISO 4217 currency code"USD"
customerIdStringID of the customer who made the purchase."cust_98765"
customerCountryStringCountry code of the customer in ISO 3166-1 alpha-2 format."US"
paymentMethodNameStringPayment method."Visa"
orderIdStringOrder ID."1234567890"
purchaseIdStringA unique ID to track the transaction."pr_xxxxxx"*/}

Example code

extension ViewController: ACCheckoutPurchaseDelegate {
    func onInitialized() {
        print("SDK initialization was successful.")
    }
    func onInitializeFailed(error: ACErrorMessage) {
        print("SDK initialization failed: \(error)")
    }
    func onPricePointsSuccess(pricePoints: PricePoints) {
        print("Price points were successfully retrieved: \(pricePoints)")
    }
    func onPricePointsFailed(error: ACErrorMessage) {
        print("Price points were not available: \(error)")
    }
    func onPurchaseSuccess(order: OrderResponseModel) {
        print("Purchase was successful: \(order.orderId ?? "No order ID found.")")
    }
    func onPurchaseFailed(error: ACErrorMessage) {
        print("Purchase failed: \(error)")
    }
    func onAward(success: Bool) {
        print("Award was \(success ? "successful" : "failed")")
    }
    func onNoneAwardedSuccess(orderIds: [String]) {
        print("None awarded was successful: \(orderIds)")
    }
    func onNoneAwardedFailed(error: ACErrorMessage) {
        print("None awarded was failed: \(error)")
    }
}