1.1.0 • Published 1 year ago

@gif-games/capacitor-samsung-iap v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@gif-games/capacitor-samsung-iap

Capacitor plugin for Samsung IAP Android SDK

Install

npm install @gif-games/capacitor-samsung-iap
npx cap sync

Include sub dependencies

Add this to your app's settings.gradle

include ':IAP6Helper'
project(':IAP6Helper').projectDir = new File('../node_modules/@gif-games/capacitor-samsung-iap/android/IAP6Helper')

API

setOperationMode(...)

setOperationMode(options: SetOperationModeOptions) => Promise<void>

IAP supports three operational modes. One is for enabling billing for item purchases and the other two are for testing IAP functions without billing app users for item purchases.

ParamType
optionsSetOperationModeOptions

getOwnedList(...)

getOwnedList(options: GetOwnedListOptions) => Promise<OwnedList>

returns a list of in-app items that the app user currently has from previous purchases:

  • Consumable items that have not yet been used and not yet reported as consumed
  • Non-consumable items
  • Subscription items currently in a free trial or an active subscription period (this includes canceled subscription items until their active subscription period has ended)
ParamType
optionsGetOwnedListOptions

Returns: Promise<OwnedList>


getProductsDetails(...)

getProductsDetails(options: GetProductsDetailsOptions) => Promise<ProductList>

returns information for one, more, or all in-app items registered to the app.

ParamType
optionsGetProductsDetailsOptions

Returns: Promise<ProductList>


startPayment(...)

startPayment(options: StartPaymentOptions) => Promise<PurchaseVo>

initiates the purchase and payment transaction of the specified in-app item and can notify the end user if the purchase succeeded or failed.

ParamType
optionsStartPaymentOptions

Returns: Promise<PurchaseVo>


consumePurchasedItems(...)

consumePurchasedItems(options: ConsumePurchasedItemsOptions) => Promise<ConsumeList>

reports one or more purchased consumable items as consumed, which makes the items available for another purchase.

ParamType
optionsConsumePurchasedItemsOptions

Returns: Promise<ConsumeList>


Interfaces

SetOperationModeOptions

PropTypeDescription
mode'production' | 'test' | 'test_fail'- production : startPayment() requests are processed as specified, financial transactions do occur for successful requests, and actual results are returned (successful or failed). Note: For all other IAP Helper requests: Only items purchased in OPERATION_MODE_PRODUCTION mode are considered owned items. - test : startPayment() requests are processed as specified, except financial transactions do not occur (licensed testers are not billed for item purchases), and successful results are always returned. For details of the payment window shown in OPERATION_MODE_TEST mode, see below. Note: For all other IAP Helper requests: - Only items purchased in OPERATION_MODE_TEST mode are considered owned items. - In order to purchase in-app items, testers must be registered as a License Tester in the seller's Seller Portal profile. In this mode, licensed testers always get your in-app items for free. All other users see an error message if they try to purchase an in-app item. - test_fail : All IAP Helper requests fail. It is meant to be a negative testing to ensure that your app can handle errors such as improper input and user actions.

OwnedList

PropType
dataOwnedProductVo[]

OwnedProductVo

PropType
mPaymentIdstring
mPurchaseIdstring
mPurchaseDatestring
mPassThroughParamstring
mSubscriptionEndDatestring

GetOwnedListOptions

PropTypeDescription
productType'item' | 'subscription' | 'all'(Required) Type of in-app items to be returned: - item : Both consumable and non-consumable items - subscription : Auto-recurring subscription items - all : Consumable, non-consumable, and auto-recurring subscription items

ProductList

PropType
dataProductVo[]

ProductVo

PropType
mItemImageUrlstring
mItemDownloadUrlstring
mReserved1string
mReserved2string
mFreeTrialPeriodstring
mSubscriptionDurationUnitstring
mSubscriptionDurationMultiplierstring
mTieredSubscriptionYNstring
mTieredPricestring
mTieredPriceStringstring
mTieredSubscriptionCountstring
mTieredSubscriptionDurationMultiplierstring
mTieredSubscriptionDurationUnitstring
mShowStartDatenumber
mShowEndDatenumber

GetProductsDetailsOptions

PropTypeDescription
productIdsstring[](Required) One or more in-app item IDs specified by either: Empty array [] that designates all in-app items or One or more unique in-app item ID values You can get the IDs from Seller Portal (Applications page > Click status of the app > In App Purchase tab > Item ID).

PurchaseVo

PropType
mPaymentIdstring
mPurchaseIdstring
mPurchaseDatestring
mVerifyUrlstring
mPassThroughParamstring
mItemImageUrlstring
mItemDownloadUrlstring
mReserved1string
mReserved2string
mOrderIdstring
mUdpSignaturestring

StartPaymentOptions

PropTypeDescription
itemIdstring(Required) Unique identifier value of the in-app item to be purchased.
passThroughParamstringOptional Unique identifier (maximum: 255 bytes) assigned by your Android app to the purchase and payment transaction. When specified, the value will be returned by OnPaymentListener interface. When the iap/v6/receipt is called from the Samsung IAP Server API to verify a purchase, the value will be returned by the pathThroughParam field.

ConsumeList

PropType
dataConsumeVo[]

ConsumeVo

PropType
mPurchaseIdstring
mStatusStringstring
mStatusCodenumber

ConsumePurchasedItemsOptions

PropTypeDescription
purchaseIdsstring[](Required) One or more unique identifier values of the purchase and payment transactions of consumable in-app items that are to be reported as consumed
1.1.0

1 year ago

1.0.0

1 year ago