세상사는 이야기 / 도움이 되었다면 배너 클릭 부탁드려요~ →→→

2019년 1월 2일 수요일

[Android] IAP Subscription Google 영수증 정보

[Android] IAP Subscription Google 영수증 정보

UnityIAP 구독 처리 진행 Google 영수증 정보
https://docs.unity3d.com/kr/2017.4/Manual/UnityIAPPurchaseReceipts.html
https://developer.android.com/google/play/billing/billing_reference.html

로그인 시 "IAP 구독 상품"이 있는지 확인을 위한 "구독 영수증 정보"를 정리했다.
구글에서는 "IAP 구독 테스트"를 위해 기간에 상관없이 5분에 한번씩 결제가 되어서 빠르게 영수증 정보가 확인 가능하다.(자동으로 5번까지 결제됨)

1. 구독 첫 결제
autoRenewing = true
GPA.1234-1234-1234-12345 -
{
    "Store":"GooglePlay",
    "TransactionID":"GPA.1234-1234-1234-12345",
    "Payload":"
    {
        \"json\":\"
        {
            \\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
            \\\"packageName\\\":\\\"com.kor.fms\\\",
            \\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
            \\\"purchaseTime\\\":1545900055028,
            \\\"purchaseState\\\":0,
            \\\"developerPayload\\\":\\\"
            {
                \\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
                \\\\\\\"is_free_trial\\\\\\\":false,
                \\\\\\\"has_introductory_price_trial\\\\\\\":false,
                \\\\\\\"is_updated\\\\\\\":false
            }
            \\\",
            \\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
            \\\"autoRenewing\\\":true
        }\",
        \"signature\":\"5t7anjvTKxP9zOIpqWqqS2A5n\y......wcQlJywnpE4yb8VtGZAsiWkFB06BF5EMA==\",
        \"skuDetails\":\"
        {
            \\\"productId\\\":\\\"com.kor.kor.subsoldierpack\\\",
            \\\"type\\\":\\\"subs\\\",
            \\\"price\\\":\\\"₩3,900\\\",
            \\\"price_amount_micros\\\":3900000000,
            \\\"price_currency_code\\\":\\\"KRW\\\",
            \\\"subscriptionPeriod\\\":\\\"P1W\\\",
            \\\"title\\\":\\\"Soldier Pack(7days)\\\",
            \\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
        }\",
        \"isPurchaseHistorySupported\":true
    }"
}


1-1. 구독 정보 확인
GPA.1234-1234-1234-12345 -
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,
\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
\\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false
}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":true
}\",
\"signature\":\"k4naFJ4RxZV7qC33U7D7Q74ouevyhLTXG\\/Rk+\\/BAkPsfwDy8AvJwneEpVgvt05HVqd0N8CwCV4xJEF7if\\/==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}


2. 구독 두번째 결제 
autoRenewing = true

구독 정보 receipt
GPA.1234-1234-1234-12345 -
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",\
\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false
}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":true
}\",
\"signature\":\"k4naFJ4RxZV7qC33U7D7Q74ouevyhLTXG\\/Rk+\\//BAkPsfwDy8AvJwneEpVgvt05HVqd0N8CwCV4xJEF7if\\/==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}

3. 구독 취소
autoRenewing = false
signature값이 변경되서 온다

구독 정보 receipt
GPA.1234-1234-1234-12345 - 
{
"Store":"GooglePlay",
"TransactionID":"GPA.1234-1234-1234-12345",
"Payload":"
{
\"json\":\"
{
\\\"orderId\\\":\\\"GPA.1234-1234-1234-12345\\\",
\\\"packageName\\\":\\\"com.kor.fms\\\",
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"purchaseTime\\\":1545964510849,\\\"purchaseState\\\":0,
\\\"developerPayload\\\":\\\"
{
\\\\\\\"developerPayload\\\\\\\":\\\\\\\"asdfokjdfsafOTI0N3M2RljEz\\\\\\\\n\\\\\\\",
\\\\\\\"is_free_trial\\\\\\\":false,
\\\\\\\"has_introductory_price_trial\\\\\\\":false,
\\\\\\\"is_updated\\\\\\\":false}\\\",
\\\"purchaseToken\\\":\\\"maddfaddkoodicpdkdclfpdf.AO-Rl-PBiB3myqbdk4zyWht_DFdfdfWyNVNmutQXSAD\\\",
\\\"autoRenewing\\\":false
}\",
\"signature\":\"qUCNlHNY6TJHZxVMTiaPPO6Fuis\\/De\\//+EJl7G0\\/uolQ\\//E5i5qm5rJFbG60\\/FqqWlbXAgLoeEIzA==\",
\"skuDetails\":\"
{
\\\"productId\\\":\\\"com.kor.fms.mysoldierpack\\\",
\\\"type\\\":\\\"subs\\\",
\\\"price\\\":\\\"₩3,900\\\",
\\\"price_amount_micros\\\":3900000000,
\\\"price_currency_code\\\":\\\"KRW\\\",
\\\"subscriptionPeriod\\\":\\\"P1W\\\",
\\\"title\\\":\\\"My Soldier Pack(7days) (MY GAME)\\\",
\\\"description\\\":\\\"300 Gems immediately.\\\\nAnd more during the subscription period.\\\"
}\",
\"isPurchaseHistorySupported\":true
}"
}

4. 구독 끝 
아무 정보도 오지 않는다.

 구독 정보 receipt
""

댓글 2개:

  1. 구독 정보는 API는
    https://www.googleapis.com/androidpublisher/v3/applications/packageName/purchases/subscriptions/subscriptionId/tokens/token:acknowledge
    요거를 쓰신건가여?

    답글삭제
    답글
    1. 죄송합니다. Unity IAP를 사용했습니다. 정보가 부족했네요.

      https://developer.android.com/google/play/billing/billing_reference.html

      삭제