For AI agents: the complete documentation index is available at https://docs.somiri.dev/breeze-iap/zh/llms.txt, the full documentation bundle is available at https://docs.somiri.dev/breeze-iap/zh/llms-full.txt, and this page is available as Markdown at https://docs.somiri.dev/breeze-iap/zh/api/types.md.
  • 简体中文
  • 타입 정의

    InitializeDto

    스토어에 등록할 상품 하나를 정의하는 구조체입니다.

    public readonly struct InitializeDto
    {
        public string      ProductId   { get; init; }
        public ProductType ProductType { get; init; }
    }
    필드타입설명
    ProductIdstringApp Store Connect / Google Play Console에 등록된 상품 ID와 정확히 일치해야 합니다.
    ProductTypeProductTypeConsumable(소모성), NonConsumable(비소모성), Subscription(구독) — UnityEngine.Purchasing에서 제공합니다.

    예시

    new InitializeDto { ProductId = "gold_100",  ProductType = ProductType.Consumable }
    new InitializeDto { ProductId = "no_ads",    ProductType = ProductType.NonConsumable }
    new InitializeDto { ProductId = "vip_month", ProductType = ProductType.Subscription }

    PurchaseResult

    PurchaseAsync 반환값 또는 GetPendingList의 항목입니다.

    public readonly struct PurchaseResult
    {
        public PurchaseType Type          { get; init; }
        public Product      Product       { get; init; }
        public PendingOrder Order         { get; init; }
        public string       ErrorMessage  { get; init; }
        public string       Receipt       => Order?.Info?.Receipt;
        public string       TransactionId => Order?.Info?.TransactionID;
        public bool         IsSuccess     => string.IsNullOrEmpty(ErrorMessage);
    }
    필드타입설명
    TypePurchaseType구매가 어떤 경로로 도달했는지를 나타냅니다.
    ProductProductUnity IAP Product 객체. Product.definition.id로 상품 ID를 가져옵니다.
    OrderPendingOrderUnity IAP v5 주문. Confirm에 전달하여 구매를 확정합니다. 실패/Deferred 결과에서는 null입니다.
    ErrorMessagestringIsSuccess가 false일 때 실패 이유가 담겨 있습니다.
    ReceiptstringOrder.Info.Receipt에서 가져온 영수증 JSON. 서버 검증에 사용합니다.
    TransactionIdstringOrder.Info.TransactionID에서 가져온 스토어 트랜잭션 ID.
    IsSuccessboolErrorMessage가 비어있으면 true.

    자주 사용하는 패턴

    var result = await BreezeIAP.PurchaseAsync("gold_100");
    
    // 성공 여부 확인
    if (!result.IsSuccess)
    {
        Debug.LogWarning(result.ErrorMessage);
        return;
    }
    
    // 상품 ID 가져오기
    string productId = result.Product.definition.id;
    
    // 서버 검증용 데이터
    string receipt       = result.Receipt;
    string transactionId = result.TransactionId;

    PurchaseType

    PurchaseResult.Type에 설정되는 열거형으로, 구매가 어떤 경로로 도달했는지를 나타냅니다.

    public enum PurchaseType
    {
        Purchase,  // 정상 구매 흐름
        Pending,   // 이전 세션에서 재전달된 미확정 구매
        Deferred,  // 외부 승인 대기 중 (예: Ask to Buy)
        Restore,   // iOS 복원을 통해 도달
        Error      // 구매 실패
    }
    값설명Confirm 필요
    Purchase사용자가 직접 구매 완료✅
    Pending이전 세션의 미확정 구매 (GetPendingList에서 도달)✅
    DeferredAsk to Buy 등 외부 승인 대기 — 아직 결제되지 않음❌
    RestoreiOS 복원을 통해 도달✅
    Error구매 실패❌

    Deferred와 Error는 Order가 null이므로 Confirm을 호출하지 않아야 합니다.