CdvPurchase.Braintree.Adapter
Adapter for a payment or in-app purchase platform
- checkSupport
- finish
- handleReceiptValidationResponse
- initialize
- load
- manageBilling
- manageSubscriptions
- order
- receiptValidationBody
- requestPayment
- restorePurchases
• new Adapter(context
, options
)
Name | Type |
---|---|
context |
AdapterContext |
options |
AdapterOptions |
• _receipts: BraintreeReceipt
[] = []
• Optional
androidBridge: Bridge
• id: Platform
= Platform.BRAINTREE
Platform identifier
• Optional
iosBridge: Bridge
• log: Logger
• name: string
= 'BrainTree'
Nice name for the adapter
• options: AdapterOptions
• products: Product
[] = []
• ready: boolean
= false
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
CdvPurchase.Adapter.isSupported
• get
receipts(): Receipt
[]
List of purchase receipts.
Receipt
[]
CdvPurchase.Adapter.receipts
▸ 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
>
Adapter.handleReceiptValidationResponse
▸ initialize(): Promise
<undefined
| IError
>
Initialize the Braintree Adapter.
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
): Promise
<undefined
| IError
>
Initializes an order.
Name | Type |
---|---|
offer |
Offer |
Promise
<undefined
| IError
>
▸ receiptValidationBody(receipt
): undefined
| Body
Prepare for receipt validation
Name | Type |
---|---|
receipt |
BraintreeReceipt |
undefined
| Body
▸ requestPayment(paymentRequest
, additionalData?
): Promise
<undefined
| IError
| Transaction
>
Request a payment from the user
Name | Type |
---|---|
paymentRequest |
PaymentRequest |
additionalData? |
AdditionalData |
Promise
<undefined
| IError
| Transaction
>
▸ restorePurchases(): Promise
<void
>
Replay the queue of transactions.
Might ask the user to login.
Promise
<void
>