애플리케이션은 판매하는 상품의 리스트를 제공해야 합니다. 애플리케이션에서 코드를 사용하여 이렇게 할 수 있습니다.
각 상품은 다음 타입 중 하나여야 합니다.
Consumable | 반복 구매가 가능한 상품입니다. 가상 화폐 같은 소비 가능한 아이템에 적합하고, 복구가 불가능합니다. |
NonConsumable | 한 번만 구매할 수 있습니다. 추가 레벨 같은 일회성 구매에 적합하고 복구 가능합니다. |
Subscription | 유효 기간이 있으며, 복구 가능합니다. |
ConfigurationBuilder를 사용해 상품 리스트를 프로그램 방식으로 선언할 수 있습니다.
모든 상품 및 앞에서 언급한 타입 중 하나에 대해 고유한 크로스 스토어 식별자를 제공해야 합니다.
using UnityEngine;
using UnityEngine.Purchasing;
public class MyIAPManager {
public MyIAPManager () {
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);
// Initialize Unity IAP...
}
}
Unity IAP는 기본적으로 모든 앱 스토어에서 상품의 식별자가 동일하다고 가정합니다.
예를 들어, 앞의 예제에서 Unity IAP는 모든 앱 스토어와 통신할 때 “100_gold_coins”를 ID로 사용합니다.
iOS 및 Mac 스토어에 모두 퍼블리시함으로 인해 개발자가 두 스토어에서 모두 동일한 상품 ID를 사용할 수 없는 경우처럼 모든 스토어에서 동일한 상품 식별자를 재사용할 수 없는 경우가 있습니다.
이런 상황에 상품의 올바른 식별자가 크로스 플랫폼 ID와 다른 경우에는 Unity IAP에 해당 식별자를 알리는 메커니즘이 제공됩니다.
using UnityEngine;
using UnityEngine.Purchasing;
public class MyIAPManager {
public MyIAPManager () {
var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
{
{"100_gold_coins_google", GooglePlay.Name},
{"100_gold_coins_mac", MacAppStore.Name}
});
// Initialize Unity IAP...
}
}
이 예제에서 상품의 식별자는 Google Play에서 “100_gold_coins_google”이고 Mac 앱 스토어에서 “100_gold_coins_mac”입니다.
가능한 경우 모든 스토어에서 동일한 상품 식별자를 재사용하는 것이 좋습니다.
스토어별 식별자를 정의하면 Unity IAP가 스토어와 통신할 때 사용하는 식별자만 변경되므로 API 호출 시에는 상품의 크로스 플랫폼 식별자를 계속 사용해야 합니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.