Skip to content

Payments module

This module processes in-app purchases on the Hive Axyl server. It provides product list retrieval, payment attempts and payment result saving, payment confirmation, purchase restoration, consumable product delivery result saving, and subscription payment processing. This module does not verify receipts; the app server requests receipt verification by calling the Hive Axyl Server API. For details, see Receipt verification.

Module information

  • Package: com.com2usplatform.hiveaxyl.payments
  • Namespace: Hive.Axyl.Payments
  • Supported platforms: All (server API)
  • Minimum requirements: Unity 6000.0+

Provided interfaces

Interface Registration method Description
IPaymentsService AddPayments() Product list retrieval, payment recording, payment confirmation, purchase restoration, delivery result saving, subscription payments

Relationship with payment Add-ons

Payment Add-ons handle tasks that must call the store SDK directly. These include retrieving store products, displaying the payment screen, finishing store transactions, and receiving Steam payment authorization callbacks. This module handles tasks that the app client requests from the Hive Axyl server, such as recording payments and confirming payments. Add-ons do not replace this module, so for payment providers that have an Add-on, use the Add-on below together with this module.

For the payment types supported by each payment provider and the role of each module, see Payment.

Registration and retrieval

Register the module with AddPayments() in the registration step of HiveBootstrap.Initialize, and then retrieve it with HiveCore.Resolve<T>().

AddPayments() connects the payment module to the production server. During development and testing, register it with AddPayments(sandbox: true) to connect to the sandbox server. In production builds, register it with AddPayments() without sandbox: true.

sandbox: true changes only the payment module's target server. It does not change the target servers of other modules registered with it.

using Hive.Axyl.Core;
using Hive.Axyl.Core.Unity;   // HiveBootstrap
using Hive.Axyl.Payments;

var config = CoreConfig.CreateBuilder("{appId}").Build();

HiveBootstrap.Initialize(config, builder =>
{
    builder.AddPayments(sandbox: true);   // Development and test environments. For production builds, use AddPayments()
});

IPaymentsService payments = HiveCore.Resolve<IPaymentsService>();

Every method of IPaymentsService requires a login session. For the modules to install together, the installation procedure, and the initialization and login order, see Install the module, initialize, and log in.