Mobile Service > IAP > Android SDK IAP SDK TOAST SDK. IAP SDK. Android Studio IDE 2.3.3 Android SDK Version 2.3.3 (API Level 10). Name Reference Version License okhttp http://square.github.io/okhttp/ 1.5.4 Apache License 2.0 gson https://code.google.com/p/google-gson/ 2.2.4 Apache License 2.0 Android Studio & Gradle Toast IAP SDK Gradle Android Studio IDE. jcenter Maven Repository Remote. build.gradle repository dependency. 1. Gradle Repository buildscript repositories jcenter() Toast IAP SDK. Permission android.permission.internet com.android.vending.billing Description.. 2.
Google Play Store dependencies implementation 'com.toast.iap:iap:1.5.0' SDK v17 (API v5) - dependencies implementation 'com.toast.iap:iap-onestore:1.5.0'. Permission android.permission.access_network_state Description. SDK v16 (API v4) dependencies implementation 'com.toast.iap:iap-tstore:1.5.0' Release History SDK Version RELEASE-NOTES.md. One Store 2018 6 12 ( ) SDK v16 (API v4). SDK v17 (API v5). SDK v15.xx.xx IAP SDK 1. SDK v17 (API v5) One Store SDK INAPP_ONESTORE_NEED_UPDATE(201).
Intent intent = new Intent("android.intent.action.VIEW"); intent.setdata(uri.parse("http://m.onestore.co.kr/mobilepoc/etc/downloadguide. omp")); startactivity(intent); One Store Toast IAP SDK. OneStore ( / ). OneStore INAPP_ONESTORE_NEED_LOGIN(202). One Store AndroidMenifest.xml. <application> <meta-data android:name="iap:view_option" android:value="popup full" /> </application> OneStore - > 7. Android Manifest 2. SDK v16 (API v4) AndroidMenifest.xml. <application> <meta-data android:name="iap:plugin_mode" android:value="development" /> </application> IAP Android SDK Google Play Store, One Store. IAP Android SDK.. 1. Import Project
SDK /sample Android Studio Import Project. 2. AndroidManifest.xml IAP Web Console Store APP ID applicationid. android defaultconfig applicationid "your app id" applicationid (Google Play Store, One Store). API Reference 1.. public void setdebugmode(boolean isdebuggable); Boolean isdebuggable InAppPurchases.InAppPurchase.setDebugMode(true); 2. ( ) SDK ( ). [ ]
MarketId GG TS Store Google Play Store One Store SDK V16 (API V4) - TStore ONESTORE One Store SDK V17 (API V5) public boolean registermarketid(string marketid); String marketid AndroidMenifest.xml : <meta-data android:name="com.toast.iap.config.market" android:value="gg" /> Java : InAppPurchases.InAppPurchase.registerMarketId(marketId); // marketid : String value 3. App ID IAP Android SDK ID. App ID TOAST Console > Mobile Service > IAP. public boolean registerappid(long appid); Long appid TOAST IAP Service App ID
AndroidMenifest.xml : <meta-data android:name="com.toast.iap.config.appid" android:value="1234567" /> Java : InAppPurchases.InAppPurchase.registerAppId(1234567);// appid : long integer 4. ID.,. public boolean registeruserid(string userid); String userid InAppPurchases.InAppPurchase.registerUserId(userId); // userid : String value 5.. PurchaseCallback. 9.. 2. IAP public void requestpurchase(activity activity, long itemid, PurchaseCallback callback);
Activity activty Long itemid Web Console PurchaseCallback callback API InAppPurchases.InAppPurchase.requestPurchase(this, 1000001, new PurchaseCallback() ); @Override public void oncallback(jsonobject result, InAppPurchaseException exception) if (!result.issuccess()) // An error occurred, we need to handle the error return; // Success! Include your code to handle the results here [Response Example] "paymentseq": "2014082210002092", "purchasetoken": "5PYSHgisiCU8BditHnDbPhmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h9e1 BtXeoBA==", "itemseq": 1000001, "currency": "KRW", "price": 1000.0 6. (Consume). public void querypurchases(activity activity, PurchaseListCallback callback);
Activity activty PurchaseCallback callback API InAppPurchases.InAppPurchase.queryPurchases(this, new PurchaseListCallback() ); @Override public void oncallback(jsonarray result, InAppPurchaseException exception) if (!result.issuccess()) // An error occurred, we need to handle the error return; // Success! Include your code to handle the results here [Response Example] [ "paymentseq": "2014082210002092", "purchasetoken": "5PYSHgisiCU8BditHnDbPhmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h9e1 BtXeoBA==", "itemseq": 1000208, "currency": "KRW", "price": 1000.0, "paymentseq": "2014082210002093", "purchasetoken": "Q+os4dDsYaGiEEqkLeXQfhmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h9e1 BtXeoBA==", "itemseq": 1000208, "currency": "KRW", "price": 1000.0, "paymentseq": "2014082210002094", "purchasetoken": "GMBcODtMnX306wVlFGIcDRmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h9e1 BtXeoBA==", "itemseq": 1000208, "currency": "KRW", "price": 1000.0 ]
7.. public void queryitems(activity activity, PurchaseListCallback callback); Activity activty PurchaseCallback callback API InAppPurchases.InAppPurchase.queryItems(activity, new InAppPurchase.ItemListCallback() @Override public void oncallback(jsonarray result, InAppPurchaseException exception) if (exception!= null) // An error occurred, we need to handle the error return; // Success! Include your code to handle the results here ); [Response Example] [, "itemseq" : 1000208, "itemname" : "Test item 01", "marketitemid": "item01", "price": 1000, "currency": "KRW", "localizedprice":" 1,000" "itemseq" : 1000209, "itemname" : "Test item 02", "marketitemid": "item02", "price": 7.99, "currency": "USD", "localizedprice":"$7.99"
] 8. (IAP ). public void processesincompletepurchases(activity activity, IncompletePurchasesCallback callback); Activity activty IncompletePurchasesCallback callback API InAppPurchases.InAppPurchase.processesIncompletePurchases(activity, new InAppPurchase.IncompletePurchasesCallback() ); @Override public void oncallback(jsonobject result, InAppPurchaseException exception) if (exception!= null) // An error occurred, we need to handle the error return; // Success! Include your code to handle the results here [Response Example] "successlist": [ "paymentseq" : "2014082510002163", "purchasetoken" : "8nkx3SzHKlI74vmgQLzHExmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h9 e1btxeob-ab", "itemseq" : 1000208, "marketitemid" : "item01", "currency" : "KRW",
"price" : 1000.0, "paymentseq" : "2014082510002164", "purchasetoken" : "8nkx3SzATKlI74vmgQLzHExmlS/0DSt4JDs2UMyg1/EY8oC6Q8qkuw5VBo7GNrBYLNUy656GCAh7h 9e1BtXeoBaAC", "itemseq" : 1000209, "marketitemid" : "item02", "currency" : "KRW", "price" : 1000.0 ], "faillist": [ "paymentseq" : "2014082510002165", "purchasetoken" : null, "itemseq" : 1000210, "marketitemid" : "item03", "currency" : "KRW", "price" : 1000.0 ] 9. IAP. API. Payment Consume API 1. InAppPurchaseException API. InAppPurchaseException null. Method Name Return type Description geterrorcode Integer. getmessage String.
InAppPurchases.InAppPurchase.queryItems(activity, new InAppPurchase.ItemListCallback() @Override public void oncallback(jsonarray result, InAppPurchaseException exception) if (exception!= null) int errorcode = exception.geterrorcode(); String errormessage = exception.getmessage(); // TODO :.... return; // Success! Include your code to handle the results here );