CdvPurchase.Adapter
Adapter for a payment or in-app purchase platform
- checkSupport
- finish
- handleReceiptValidationResponse
- initialize
- load
- manageBilling
- manageSubscriptions
- order
- receiptValidationBody
- requestPayment
- restorePurchases
• id: Platform
Platform identifier
• name: string
Nice name for the adapter
• ready: boolean
true after the platform has been successfully initialized.
The value is set by the "Adapters" class (which is responsible for initializing adapters).
• get
isSupported(): boolean
Returns true is the adapter is supported on this device.
boolean
• get
products(): Product
[]
List of products managed by the adapter.
Product
[]
• get
receipts(): Receipt
[]
List of purchase receipts.
Receipt
[]
▸ checkSupport(functionality
): boolean
Returns true if the platform supports the given functionality.
Name | Type |
---|---|
functionality |
PlatformFunctionality |
boolean
▸ finish(transaction
): Promise
<undefined
| IError
>
Finish a transaction.
For non-consumables, this will acknowledge the purchase. For consumable, this will acknowledge and consume the purchase.
Name | Type |
---|---|
transaction |
Transaction |
Promise
<undefined
| IError
>
▸ handleReceiptValidationResponse(receipt
, response
): Promise
<void
>
Handle platform specific fields from receipt validation response.
Name | Type |
---|---|
receipt |
Receipt |
response |
Payload |
Promise
<void
>
▸ initialize(): Promise
<undefined
| IError
>
Initializes a platform adapter.
Will resolve when initialization is complete.
Will fail with an IError
in case of an unrecoverable error.
In other case of a potentially recoverable error, the adapter will keep retrying to initialize forever.
Promise
<undefined
| IError
>
▸ load(products
): Promise
<(IError
| Product
)[]>
Load product definitions from the platform.
Name | Type |
---|---|
products |
IRegisterProduct [] |
▸ manageBilling(): Promise
<undefined
| IError
>
Open the platforms' billing management interface.
Promise
<undefined
| IError
>
▸ manageSubscriptions(): Promise
<undefined
| IError
>
Open the platforms' subscription management interface.
Promise
<undefined
| IError
>
▸ order(offer
, additionalData
): Promise
<undefined
| IError
>
Initializes an order.
Name | Type |
---|---|
offer |
Offer |
additionalData |
AdditionalData |
Promise
<undefined
| IError
>
▸ receiptValidationBody(receipt
): undefined
| Body
Prepare for receipt validation
Name | Type |
---|---|
receipt |
Receipt |
undefined
| Body
▸ requestPayment(payment
, additionalData?
): Promise
<undefined
| IError
| Transaction
>
Request a payment from the user
Name | Type |
---|---|
payment |
PaymentRequest |
additionalData? |
AdditionalData |
Promise
<undefined
| IError
| Transaction
>
▸ restorePurchases(): Promise
<void
>
Replay the queue of transactions.
Might ask the user to login.
Promise
<void
>