Initialize the contract with admin, treasury, and auth addresses. Can be called once by the deploying admin to set up roles.
fn initialize(
env: soroban_sdk::Env,
admin: soroban_sdk::Address,
treasury: soroban_sdk::Address,
auth: soroban_sdk::Address,
)
Create a new IAP product (admin only).
fn create_product(
env: soroban_sdk::Env,
product_id: soroban_sdk::Bytes,
product_type: soroban_sdk::Bytes,
name: soroban_sdk::Bytes,
description: soroban_sdk::Bytes,
price: i128,
currency: soroban_sdk::Bytes,
image_url: soroban_sdk::Bytes,
metadata: soroban_sdk::Bytes,
iap_category: IapCategory,
)
Update an existing IAP product (admin only).
fn update_product(
env: soroban_sdk::Env,
product_id: soroban_sdk::Bytes,
new_type: soroban_sdk::Bytes,
new_name: soroban_sdk::Bytes,
new_description: soroban_sdk::Bytes,
new_price: i128,
new_currency: soroban_sdk::Bytes,
new_image_url: soroban_sdk::Bytes,
new_metadata: soroban_sdk::Bytes,
new_category: IapCategory,
)
Delete an IAP product (admin only).
fn delete_product(env: soroban_sdk::Env, product_id: soroban_sdk::Bytes)
Retrieve IAP product details by productId.
fn get_product(
env: soroban_sdk::Env,
product_id: soroban_sdk::Bytes,
) -> Option
Purchase an IAP product:
fn purchase(
env: soroban_sdk::Env,
user: soroban_sdk::Address,
user_id: soroban_sdk::Bytes,
product_id: soroban_sdk::Bytes,
price: i128,
)