To implement the iOS Mobile Checkout SDK, include the following callback methods:

MethodDescriptionArgumentType
OnInitializedTriggered when SDK initialization was successful.
OnInitializeFailedTriggered when SDK initialization failed.
OnPricePointsSuccessTriggered when price points are successfully retrieved, after calling GetPricePoints.pricePointsPricePointsModel
OnPricePointsFailTriggered when price points can’t be retrieved or are unavailable, after calling GetPricePoints.errorErrorMessage
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 an error code, message, and JSON.errorErrorMessage
OnPurchaseConsumedTriggered when a purchase was either consumed or not consumed.consumedboolean
OnGetNonConsumeOrdersSuccessTriggered when the list of non-consumed orders is successfully retrieved.nonConsumedOrdersList<string>
OnGetNonConsumeOrdersFailTriggered when retrieval of non-consumed orders failed.errorErrorMessage

The OrderResponseModel argument type 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 player who made the purchase."cust_98765"
customerCountryStringCountry code of the player 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

using System.Collections.Generic;
using Appcharge.iOS.Checkout.Interfaces;
using Appcharge.iOS.Checkout.Models;

public class AppchargeCallbackImpl : ICheckoutPurchase
{
    public void OnInitialized()
    {
        Debug.Log("SDK initialization was successful.");
    }

    public void OnInitializeFailed(ErrorMessage error)
    {
        Debug.Log("SDK initialization failed.");
    }

    public void OnPricePointsSuccess(PricePointsModel pricePoints)
    {
       Debug.Log("Price points retrived.");
    }

    public void OnPricePointsFail(ErrorMessage error)
    {
        Debug.Log("Failed to retrieve price points.");
    }

    public void OnPurchaseSuccess(OrderResponseModel order, string sessionMetadata)
    {
        Debug.Log("Purchase was successful.");
    }

    public void OnPurchaseFailed(ErrorMessage error, string sessionMetadata)
    {
        Debug.Log("Purchase failed.");
    }

    public void OnPurchaseConsumed(bool consumed)
    {
        Debug.Log("Purchase was either consumed or not consumed.");
    }

    public void OnGetNonConsumeOrdersSuccess(List<string> nonConsumedOrders)
    {
        Debug.Log("List of non-consumed purchases was sucessfully retrieved.");
    }

    public void OnGetNonConsumeOrdersFail(ErrorMessage error)
    {
        Debug.Log("Failed to retrieve list of non-consumed purchases.");
    }
}