To implement the iOS Payment Links SDK, include the following callback methods:
MethodDescriptionArgumentType
OnInitializedTriggered when SDK initialization was successful.
OnInitializeFailedTriggered when SDK initialization failed.errorErrorMessage
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
OnAwardTriggered when a purchase was either awarded or not.successboolean
OnNoneAwardedSuccessTriggered when the list of non-awarded orders is successfully retrieved.noneAwardedList<string>
OnNoneAwardedFailedTriggered when the retrieval of non-awarded 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)
    {
        Debug.Log("Purchase was successful.");
    }

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

    public void OnAward(bool success)
    {
        Debug.Log("Purchase was either awarded or not awarded.");
    }

    public void OnNoneAwardedSuccess(List<string> noneAwarded)
    {
        Debug.Log("List of non-awarded purchases was sucessfully retrieved.");
    }

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