Skip to content

Latest commit

 

History

History
229 lines (129 loc) · 4.44 KB

CdvPurchase.Transaction.md

File metadata and controls

229 lines (129 loc) · 4.44 KB

Class: Transaction

CdvPurchase.Transaction

Transaction as reported by the device

See

Hierarchy

Table of contents

Properties

Accessors

Methods

Properties

amountMicros

Optional amountMicros: number

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


currency

Optional currency: string

Currency used to pay for the transaction, if known.


expirationDate

Optional expirationDate: Date

Time when the subscription is set to expire following this transaction


isAcknowledged

Optional isAcknowledged: boolean

True when the transaction has been acknowledged to the platform.


isConsumed

Optional isConsumed: boolean

True when the transaction was consumed.


isPending

Optional isPending: boolean

True when the transaction is still pending payment.


lastRenewalDate

Optional lastRenewalDate: Date

Time a subscription was last renewed


platform

platform: Platform

Platform this transaction was created on


products

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

Purchased 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).


purchaseId

Optional purchaseId: string

Identifier for the purchase this transaction is a part of.


renewalIntent

Optional renewalIntent: RenewalIntent

Is the subscription set to renew.


renewalIntentChangeDate

Optional renewalIntentChangeDate: Date

Time when the renewal intent was changed


state

state: TransactionState = TransactionState.UNKNOWN_STATE

State this transaction is in


transactionId

transactionId: string = ''

Transaction identifier.

Accessors

parentReceipt

get parentReceipt(): Receipt

Return the receipt this transaction is part of.

Returns

Receipt

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>


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>