Skip to content

Latest commit

 

History

History
365 lines (203 loc) · 8.09 KB

CdvPurchase.GooglePlay.Transaction.md

File metadata and controls

365 lines (203 loc) · 8.09 KB

Class: Transaction

CdvPurchase.GooglePlay.Transaction

Transaction as reported by the device

See

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Transaction(purchase, parentReceipt, decorator)

Parameters

Name Type
purchase Purchase
parentReceipt Receipt
decorator TransactionDecorator

Overrides

CdvPurchase.Transaction.constructor

Properties

amountMicros

Optional amountMicros: number

Amount paid by the user, if known, in micro units. Divide by 1,000,000 for value.

Inherited from

Transaction.amountMicros


currency

Optional currency: string

Currency used to pay for the transaction, if known.

Inherited from

Transaction.currency


expirationDate

Optional expirationDate: Date

Time when the subscription is set to expire following this transaction

Inherited from

Transaction.expirationDate


isAcknowledged

Optional isAcknowledged: boolean

True when the transaction has been acknowledged to the platform.

Inherited from

Transaction.isAcknowledged


isConsumed

Optional isConsumed: boolean

True when the transaction was consumed.

Inherited from

Transaction.isConsumed


isPending

Optional isPending: boolean

True when the transaction is still pending payment.

Inherited from

Transaction.isPending


lastRenewalDate

Optional lastRenewalDate: Date

Time a subscription was last renewed

Inherited from

Transaction.lastRenewalDate


nativePurchase

nativePurchase: Purchase


platform

platform: Platform

Platform this transaction was created on

Inherited from

Transaction.platform


products

products: { id: string ; offerId?: string }[] = []

Purchased products

Inherited from

Transaction.products


purchaseDate

Optional purchaseDate: Date

Time the purchase was made.

For subscriptions this is equal to the date of the first transaction. Note that it might be undefined for deleted transactions (google for instance don't provide any info in that case).

Inherited from

Transaction.purchaseDate


purchaseId

Optional purchaseId: string

Identifier for the purchase this transaction is a part of.

Inherited from

Transaction.purchaseId


renewalIntent

Optional renewalIntent: RenewalIntent

Is the subscription set to renew.

Inherited from

Transaction.renewalIntent


renewalIntentChangeDate

Optional renewalIntentChangeDate: Date

Time when the renewal intent was changed

Inherited from

Transaction.renewalIntentChangeDate


state

state: TransactionState = TransactionState.UNKNOWN_STATE

State this transaction is in

Inherited from

Transaction.state


transactionId

transactionId: string = ''

Transaction identifier.

Inherited from

Transaction.transactionId

Accessors

parentReceipt

get parentReceipt(): Receipt

Return the receipt this transaction is part of.

Returns

Receipt

Inherited from

CdvPurchase.Transaction.parentReceipt

Methods

finish

finish(): Promise<void>

Finish a transaction.

When the application has delivered the product, it should finalizes the order. Only after that, money will be transferred to your account. This method ensures that no customers is charged for a product that couldn't be delivered.

Example

store.when()
  .approved(transaction => transaction.verify())
  .verified(receipt => receipt.finish())

Returns

Promise<void>

Inherited from

Transaction.finish


refresh

refresh(purchase): void

Refresh the value in the transaction based on the native purchase update

Parameters

Name Type
purchase Purchase

Returns

void


verify

verify(): Promise<void>

Verify a transaction.

This will trigger a call to the receipt validation service for the attached receipt. Once the receipt has been verified, you can finish the transaction.

Example

store.when()
  .approved(transaction => transaction.verify())
  .verified(receipt => receipt.finish())

Returns

Promise<void>

Inherited from

Transaction.verify


toState

Static toState(state, isAcknowledged): TransactionState

Parameters

Name Type
state PurchaseState
isAcknowledged boolean

Returns

TransactionState