Launching Checkout

Setup the Product

In this step, create the product and set up its name, price, and additional information:

var model = SessionRequestModel(  
    "John Doe",
    "[email protected]",
    129,
    "usd",
    "BestDealPackage",
    "Best_deal_package",
    "",
    "Coin Pack Bundle"  
)  

Session Request Model Arguments

ArgumentIs MandatoryDescription
customerIdmandatoryThe name or identifier of the customer.
emailThe customer's email address. Although not mandatory, providing it helps expedite the payment process.
pricemandatoryThe price in cents, which will be converted by Appcharge.
currencymandatoryThe currency used for the transaction, e.g., usd, eur.
offerNamemandatoryThe name of the offer.
offerSkumandatoryThe SKU number or text for the offer.
offerAssetUrlA URL displaying an image for the offer.
offerDescriptionmandatoryA description of the offer.

Session Metadata (Optional)

The session metadata allows you to add extra data for BI (Business Intelligence) and tracking purposes.

model.sessionMetadata.Add(key: String, value: String)

Adding Items to the Offer

You must add at least one item to the offer.

var model = SessionRequestModel(...) // Your session model

model.items.Add(new OfferItemModel(
	"Coins",
	"https://media-dev.appcharge.com/media/product-3.png",
	"coins_xo",
	300
));

Offer Item Arguments

ArgumentIs MandatoryDescription
nameyesThe name for the item
assetUrlyesThe URL of an image to display the item.
skuyesThe SKU of the item.
quantityyesThe quantity of the item. For example, if the name is "Coins" and the quantity is 300, it will be displayed as "300 Coins."
quantityDisplaynoThe Quantity Display allows you to replace the numerical quantity with custom text.

Open Checkout

In the final step, open the checkout by passing the product model to it:

CheckoutController.Instance.OpenCheckout(model);

At runtime, a new window will open, guiding the user through the purchase process. Based on user interaction, the following interface methods will be triggered:

MethodDescription
OnPurchaseSuccessTriggered when the user successfully completes the purchase.
OnPurchaseFailedTriggered when the checkout window is closed or if an error occurs during the purchasing process.