@gif-games/capacitor-samsung-iap
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

@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.

Param Type
options SetOperationModeOptions

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)
Param Type
options GetOwnedListOptions

Returns: Promise<OwnedList>


getProductsDetails(...)

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

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

Param Type
options GetProductsDetailsOptions

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.

Param Type
options StartPaymentOptions

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.

Param Type
options ConsumePurchasedItemsOptions

Returns: Promise<ConsumeList>


Interfaces

SetOperationModeOptions

Prop Type Description
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

Prop Type
data OwnedProductVo[]

OwnedProductVo

Prop Type
mPaymentId string
mPurchaseId string
mPurchaseDate string
mPassThroughParam string
mSubscriptionEndDate string

GetOwnedListOptions

Prop Type Description
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

Prop Type
data ProductVo[]

ProductVo

Prop Type
mItemImageUrl string
mItemDownloadUrl string
mReserved1 string
mReserved2 string
mFreeTrialPeriod string
mSubscriptionDurationUnit string
mSubscriptionDurationMultiplier string
mTieredSubscriptionYN string
mTieredPrice string
mTieredPriceString string
mTieredSubscriptionCount string
mTieredSubscriptionDurationMultiplier string
mTieredSubscriptionDurationUnit string
mShowStartDate number
mShowEndDate number

GetProductsDetailsOptions

Prop Type Description
productIds string[] (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

Prop Type
mPaymentId string
mPurchaseId string
mPurchaseDate string
mVerifyUrl string
mPassThroughParam string
mItemImageUrl string
mItemDownloadUrl string
mReserved1 string
mReserved2 string
mOrderId string
mUdpSignature string

StartPaymentOptions

Prop Type Description
itemId string (Required) Unique identifier value of the in-app item to be purchased.
passThroughParam string Optional 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

Prop Type
data ConsumeVo[]

ConsumeVo

Prop Type
mPurchaseId string
mStatusString string
mStatusCode number

ConsumePurchasedItemsOptions

Prop Type Description
purchaseIds string[] (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

Package Sidebar

Install

npm i @gif-games/capacitor-samsung-iap

Weekly Downloads

0

Version

1.1.0

License

MIT

Unpacked Size

2.63 MB

Total Files

522

Last publish

Collaborators

  • rohit_kaushal
  • sneakysensei