Skip to content

Instantly share code, notes, and snippets.

@benigumocom
Last active January 4, 2025 05:38
Show Gist options
  • Save benigumocom/d9c8705b3f410915fd163f9ab9cab061 to your computer and use it in GitHub Desktop.
Save benigumocom/d9c8705b3f410915fd163f9ab9cab061 to your computer and use it in GitHub Desktop.
【Kotlin】Android アプリ 課金実装時の ProductDetails や Purchase の内容 https://android.benigumo.com/20250104/billing-params/
fun ProductDetails.showLog() {
Timber.d("ProductDetails")
Timber.d(" productId : ${this.productId}")
Timber.d(" productType : ${this.productType}")
Timber.d(" title : ${this.title}")
Timber.d(" name : ${this.name}")
Timber.d(" description : ${this.description}")
this.subscriptionOfferDetails?.forEachIndexed { index, offer ->
Timber.d(" subscriptionOfferDetails")
Timber.d(" index : $index")
Timber.d(" offerId : ${offer.offerId}")
Timber.d(" offerToken : ${offer.offerToken}")
Timber.d(" offerTags : ${offer.offerTags}")
offer.pricingPhases.pricingPhaseList.forEachIndexed { index, list ->
Timber.d(" pricingPhases")
Timber.d(" index : $index")
Timber.d(" formattedPrice : ${list.formattedPrice}")
Timber.d(" priceCurrencyCode : ${list.priceCurrencyCode}")
Timber.d(" priceAmountMicros : ${list.priceAmountMicros}")
Timber.d(" billingPeriod : ${list.billingPeriod}")
Timber.d(" billingCycleCount : ${list.billingCycleCount}")
Timber.d(" recurrenceMode : ${list.recurrenceMode}")
}
offer.installmentPlanDetails?.let { plans ->
Timber.d(" installmentPlanDetails")
Timber.d(" subsequentInstallmentPlanCommitmentPaymentsCount : ${plans.subsequentInstallmentPlanCommitmentPaymentsCount}")
Timber.d(" installmentPlanCommitmentPaymentsCount : ${plans.installmentPlanCommitmentPaymentsCount}")
}
}
this.oneTimePurchaseOfferDetails?.let { details ->
Timber.d(" oneTimePurchaseOfferDetails")
Timber.d(" formattedPrice : ${details.formattedPrice}")
Timber.d(" priceAmountMicros : ${details.priceAmountMicros}")
Timber.d(" priceCurrencyCode : ${details.priceCurrencyCode}")
}
}
fun Purchase.showLog() {
Timber.d("Purchase")
Timber.d(" products : ${this.products}")
Timber.d(" purchaseToken : ${this.purchaseToken}")
Timber.d(" accountIdentifiers : ${this.accountIdentifiers}")
Timber.d(" developerPayload : ${this.developerPayload}")
Timber.d(" isAcknowledged : ${this.isAcknowledged}")
Timber.d(" isAutoRenewing : ${this.isAutoRenewing}")
Timber.d(" orderId : ${this.orderId}")
Timber.d(" originalJson : ${this.originalJson}")
Timber.d(" packageName : ${this.packageName}")
Timber.d(" purchaseState : ${this.purchaseState}")
Timber.d(" purchaseTime : ${this.purchaseTime}")
Timber.d(" quantity : ${this.quantity}")
Timber.d(" signature : ${this.signature}")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment