-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Billing v4 #40
base: master
Are you sure you want to change the base?
Billing v4 #40
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking the discussion internally for now.
appCompat : "androidx.appcompat:appcompat:${versions.appCompat}", | ||
supportAnnotations: "androidx.annotation:annotation:${versions.support}", | ||
supportAnnotations: "com.android.support:support-annotations:${versions.support}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify why this needs to be reverted to the support lib version.
tokensToBeConsumed.remove(purchaseToken); | ||
listener.failure(purchase, getConsumeError(responseCode)); | ||
if (product.isSubscription()) { | ||
api.acknowledgePurchase(purchase.token(), new AcknowledgePurchaseResponseListener() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the docs, the purchase product needs to be check if it has already been acknowledge: https://developer.android.com/google/play/billing/integrate#process.
suspend fun handlePurchase() {
if (purchase.purchaseState === PurchaseState.PURCHASED) {
if (!purchase.isAcknowledged) {
val acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder()
.setPurchaseToken(purchase.purchaseToken)
val ackPurchaseResult = withContext(Dispatchers.IO) {
client.acknowledgePurchase(acknowledgePurchaseParams.build())
}
}
}
}
What will be the effect if a purchase is repeatedly acknowledge?
I this something that the backend does?
Subscriptions are handled similarly to non-consumables. You can acknowledge a subscription Acknowledgement using either BillingClient.acknowledgePurchase() from the Google Play Billing Library or Purchases.Subscriptions.Acknowledge from the Google Play Developer API. All initial subscription purchases need to be acknowledged. Subscription renewals do not need to be acknowledged. For more information on when subscriptions need to be acknowledged, see the Sell subscriptions topic.
@@ -357,8 +380,9 @@ public void getProductDetails(@NonNull Context context, @NonNull final String sk | |||
Collections.singletonList(sku), | |||
new SkuDetailsResponseListener() { | |||
@Override | |||
public void onSkuDetailsResponse(int responseCode, List<SkuDetails> skuDetailsList) { | |||
if (responseCode == BillingResponse.OK && skuDetailsList.size() == 1) { | |||
public void onSkuDetailsResponse(BillingResult result, List<SkuDetails> skuDetailsList) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Please add the nullability annotation to the implementation:
void onSkuDetailsResponse(@NonNull BillingResult var1, @Nullable List<SkuDetails> var2);
Please see other implementations for this.
@@ -28,11 +28,8 @@ android { | |||
|
|||
dependencies { | |||
api project(':cashier') | |||
|
|||
compileOnly deps.autoValue | |||
\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove
if (accountId != null) { | ||
throw new IllegalArgumentException("Account id is not supported!"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it valid to throw the exception here? I know this is similar to the developerPayload
but I think accountId
is optional.
This PR. updates Google Billing API to version 4.0.0.
AutoParcel
to work, so allParcelable
objects are implemented by hand.consume
cashier API.