Thanks a lot for this man... Please, can u make a video on subscription and also, can the same code in the server be used to verify subscription purchase?
Bro! Please, when will you make a tutorial on subscription billing... We really need the video... No video has been comprehensive and efficient as the one you did for the in app purchase... We are hoping that you will release the subscription billing very soon
Excellent tutorial. Upgraded existing subscription code that I had become unfamiliar with overtime to Billing Lib 4 quite easily with your video. A lot of nasty legacy code to the bin..!
Very good and detailed tutorial. I have one comment though. From what you have accomplished here it is clearly visible that Firebase service, which is paid service in BLAZE plan after all, is not needed at all. Its whole functionality is just to log the purchases. Probably Firebase (or other external backend server) is needed when handling the subscriptions, but this type of purchase you haven't dealt with in this video. Am I correct? Although it is very good to learn how to work with the backend server anyway 🙂
As i understand, we need to give item to user instead of toast message. Question is... If I have 2+ different products, how can I figure out which product the user bought?
Hello, all you have to do is to loop through all the product ids that was processed in the verifyPurchase() method: AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build(); billingClient.acknowledgePurchase( acknowledgePurchaseParams, new AcknowledgePurchaseResponseListener() { @Override public void onAcknowledgePurchaseResponse(@NonNull BillingResult billingResult) { if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) { for(String sku: purchase.getSkus()) { Log.e("MainAct", "Product ID" + sku); } } } } );
This tutorial helped me alot, thank you! Very well made. I´m new to programming so i have a question, i want to give my users coins via purchases. so i put the method to collect coins into the onPurchaseUpdated method (hope thats right). It works with one InApp Item, but if ill add another i dont know where to put in the collectable coins.. :/ i´ve put the second item into the getProductDetails method and made a new textView, Button and itemInfo for it (again, hope thats the correct way). how can i get different items for different purchases?
Hello, If the purchase was not acknowledged yet, you just have to wait 3 minutes and that message will go away. Or if you want to test purchasing an item multiple times, use consumeAsync() instead.
Hi great tutorial everything is very clear, thanks!, I am facing a problem that the products do not show on the activity, Did exactly the same as you did, I do not have any errors either, what can I do?
Can you do a part two that uses a mysql server for verification? My goal (and I'm sure the same can be said for others) is max ROI, using firebase pay as you go can eat into that ROI. If a user owns their own server(s), then by using php scripts to communicate with the MySql database, that work can be done with owned resources and cut out third party services. Great video and easy to follow!
Thank you. This is mainly for In-App products. For subscriptions, it requires some modifications and additional steps. A video on that will be released soon.
Sometimes my purchases can't be consumed... usualy when i make first purchase after cold starting app. Any idea? Logs says: W/BillingHelper: Couldn't find purchase lists, trying to find single data. W/BillingHelper: Received a bad purchase data. W/BillingHelper: Couldn't find single purchase data as well.
Im change function server to nearest to me, and increase timeup... Also make triple answer from server with short pause to be shure... Now... Loks like every purchase will consume... but i still think that this function far from perfect... (
Can we use AWS cloud in place of GCP in this RTDN integration. I never integrated aws before with google play billing system . To configure Google Cloud Pub/Sub we set up the project_id, subscriber, and the topic from the developer console in it. But I dont know how do I set up these parameters in AWS cloud function for RTDN integration
thank you for this tutorial, but i guess other tutorial is not including setup a firebase or backend. so I wonder about what is different between using firebase and not. can you help me? or am I confused?
Thanks a lot for this video ! I just did not understand in what part of the process you handle the product to the user. For instance, if I offer a simple purchase to remove ads from the app, based on a user profile param (e.g. boolean isPremium = true), where do I set the "isPremium = true", and also how do I retrieve the item that got purchased that was made ? Thanks in advance :)
Hello, if your app constantly have new products, their info should be stored in a database. Then you will retrieve each product info from the data base. When the user purchase an item, you will compare the purchased product with all the other products and determine whether they are consumable or non-consumable. If your app products do not change often and do not want to use a database, then you can put all your product information in the app and do the same.
How can I fix this error in functions logs>>> : Value for argument in documentPath must point to a document, but was "purchases/$(purchasesInfo/purchasesToken)" . Your path does not contain an even number of components.
Make sure your values are inside the ` ` and not " " The ` is the button next to the 1 key. You have a slash instead of a period. Here is the correct version. `purchases/$(purchasesInfo.purchasesToken)` The `` are template strings in JavaScript. Read more about it here: www.tektutorialshub.com/javascript/tagged-templates-in-javascript/#:~:text=We%20can%20create%20a%20Template%20String%20in%20JavaScript,sign%20and%20curly%20braces%20%28%20%24%20%7Bexpression%7D%20%29. Essentially, it is a way to put variables inside a string using ` `
UPDATE: You won't believe it! The one thing that was causing the error is me using ' instead of ` . Code is now running fine. I did one thing after that, close my laptop go for a beer! This is the best tutorial on this subject. Thanks again..
Hello, it is sending the request twice because when the purchase flow UI is closed, it will go back to the app and onResume() will be called which is intended. This will not affect the outcome since it checks to see if the returned JSON object isValid property first before making the acknowledgement.
@@VictorAyalaSpooner there is a bug, just compare the order: purchaseToken: req.query.purchaseToken, orderId: req.query.orderId, purchaseTime: req.query.purchaseTime, isValid: false vs: "purchaseToken=" + purchase.getPurchaseToken() + "&" + "purchaseTime=" + purchase.getPurchaseTime() + "&" + "orderId=" + purchase.getOrderId() ; it will work, if you do it like that: "purchaseToken=" + purchase.getPurchaseToken() + "&" + "orderId=" + purchase.getOrderId() + "&" + "purchaseTime=" + purchase.getPurchaseTime();
Please help:- how to solve: BillingClient: Error consuming purchase with token. Response code: 6 and BillingClient: Error consuming purchase! I am really confuse right now....
Hi. Great tutorial. My question is that the database rules allow any user to delete or overwrite the database. Any ideas or help on how to configure the rules to prevent this from happening without affecting the validation of the purchase tokens? Thanks in advance.
Hello, it depends if you are using authentication with Firebase as well. You will add the user id to the purchaseToken JSON. This will be the configuration: allow update: if request.resource.data.uid == request.auth.uid;
@@Codeible Thanks for the quick reply. The application is very simple, and to use it does not require user authentication. Maybe is there any other way?
@@miguelgomez5529 If data is only being uploaded through Cloud Functions, you can set read and write to false. This will prevent anyone except Cloud Functions to modify.
For some reason it not letting me reply to your comment :\ The problem is that the textView and the itemName is not changing and I have no indication whats wrong :(
Hmm pretty hard to tell since I do not see the code, maybe create a new thread and loop to reset the items to see if it updates. This way, it can verify that you are getting the items.
Hi, there have been several updates since you made this video, and some functions have been deprecated, but when I call billingClient.queryProductDetailsAsync(...), I get this error "Response Code: SERVICE_UNAVAILABLE, Debug Message: An internal error occurred." . Can't find any solution🙏
hello, may i ask a question? Why can't my product/order be consumed? I have tried using acknowledge & consume code, but it doesn't work. after making a purchase, and want to buy the same product again, the message always appears that I already own this item.
@@Codeible I do have the same result, and the reason is that the firebase cloud function always retun isValid false...I have recheck the code and I can not find why...
@@VictorAyalaSpooner there is a bug, just compare the order: purchaseToken: req.query.purchaseToken, orderId: req.query.orderId, purchaseTime: req.query.purchaseTime, isValid: false vs: "purchaseToken=" + purchase.getPurchaseToken() + "&" + "purchaseTime=" + purchase.getPurchaseTime() + "&" + "orderId=" + purchase.getOrderId() ; it will work, if you do it like that: "purchaseToken=" + purchase.getPurchaseToken() + "&" + "orderId=" + purchase.getOrderId() + "&" + "purchaseTime=" + purchase.getPurchaseTime();
@codeible, the response from the server is giving me False, so, I'm not able to acknowledge the purchase. Also, in the firestore database, it's only one item I found there after storing more than one item
If I am understanding you correctly, you are talking about consuming it so you can purchase the item again? If so, you put it after your purchases was verified.
@@bartomiejsiewierski9712 i think u must store you purchase list somewhere... in sqlite database may be... or you can use shared prefferences. Or you ask about how to restore purchase... after reinstal programm? i think you must sincronise purchase on you server for this feature...
@@jorji3p577 From what I understand, Cloud Firestore should be responsible for it only the problem is that after buying nothing in Cloud Firestore and looking at Functions -> Logs it displays "Function execution took 335 ms, finished with status: 'crash' " Maybe someone has a think how to fix it?
Thanks for the video sir! I have a problem, I created 4 app dummy, they have exactly the same code (literally I copy-paste). But 2 can launch the google play purchase, while the others 2 cannot. Please, do you know how to solve this issue?
@@Codeible Yeah i did. I found the issue, my android billing always return 0 skuDetails. I already added skuList in android studio & product in google play console.
hello, thank you for this tutorial, how about subscriptions, how can we know if a user has been subscribed "lets say for a premium account" or not without a cloud functions or an external servers???? in in-app billing V3 ( Boolean b = bp.getSubscriptionListingDetails("productId").purchaseInfo )
@@Codeible i purchase the product and go to firestore database and under data there is no purchases and the purchase receipt like in the video why is that ? Help ?
@@ChillHouseMusic Hello, to debug your code, manually create the URL with your Cloud Functions request URL and then try it on the browser. Example: ?purchaseToken=123&orderId=123&purchaseTime=0 You can try using this URL: us-central1-playbillingtutorial.cloudfunctions.net/verifyPurchases?purchaseToken=123&orderId=123&purchaseTime=0 It will give you a JSON object back. Let me know the update.
"The item you requested is not available for purchase" Please, how am I going to solve this issue? I've checked stackoverflow and I've followed all the steps needed. Yet, It is still bringing out this same error message
Hello, 1) Add the account you are using for the test in the Google Play Console 2) Uninstall the app on the device 3) Go to the app settings on the phone and clear all the data/cache for the Google Play app 4) Go to the Google Play App and log in with the testing account you added on the Google Play Console 5) Run the app again Extra: Make sure the device has the Google Play app.
@@lanreakintayo3443 Ok. Are you using the emulators? It happens sometimes when you are using the emulators - simple fix should just be emptying the memory and cache from the Google Play App. Try on a phone first to see if it is working properly. Then: 1) Rebuild the project with a different version code and upload a new release. 2) Repeat the steps from earlier, but this time, run the new version first then uninstall it manually on the emulator.
You are not correctly verifying the in-app purchase. You should call the Google API to check if the purchase token is valid. When you not check this, I can send random tokens to your backend, and it responds that the purchase is valid.
@@akashdeepkashyap9806 The concept is the same as Firebase, you'll need to use AWS Lambda + API Gateway for the API logic and maybe AWS RDS for data storing. 1. Create AWS Lambda functions that accept incoming data and store it in a database like RDS 2. Create API using API Gateway 3. When the API is called, it'll trigger the Lambda and then everything is similar to Firebase.
@@Codeible As In FireBase Integration we setup our application in it. Now my ques is how this API gateway's API will be triggered if we go with your API-gateway & lambda function approach .
As of January 1, 2022, that service fee is equivalent to: For developers who are enrolled in the 15% service fee tier, the service fee is: 15% for the first $1M (USD) of earnings each year, 30% for earnings in excess of $1M (USD) each year. For developers who are not enrolled in the 15% service fee tier, the service fee is 30%. For automatically renewing subscription products purchased by subscribers, the service fee is 15%. support.google.com/googleplay/android-developer/answer/112622?hl=en
I wonder if keep acknowledge code in client side. it possible that someone could prevent acknowledgePurchase() ( reverse engineering ) they could easily get refund and the server considers them as a legit purchase.
Finally I've found a tutorial that is more than a Hello World. Many things that a dont know. Thank you my friend.
Community was beggin' you! Thanks a lot.
Can you make a video tutorial about how to implement Subscription with Play Billing V4?
yes please.
@Codeible it's need of the hour. Please
200 likes required for video please everybody like
@codeible, please, we need the subscription purchase video tutorial
yess Pleaseeeee!!
@Codeible, please subscription purchase video tutorial.
Sir, you have great videos! Please make a video tutorial about creating subscribtion as soon as possible!
Thanks a lot for this man... Please, can u make a video on subscription and also, can the same code in the server be used to verify subscription purchase?
Hello, yes. However, for subscriptions, it requires additional steps to handle the purchases.
Bro! Please, when will you make a tutorial on subscription billing... We really need the video... No video has been comprehensive and efficient as the one you did for the in app purchase... We are hoping that you will release the subscription billing very soon
yup... i'm waiting for subscription purchases too... please
Hope we get the 200 likes!!!!
🙏
Great tutorial just loved the way you explained everything. Can u please make a video for subscription too it will be a great help. Thank you ❤️❤️
Nothing is loading in my cloud storage when I purchase. Why is this?
Excellent tutorial. Upgraded existing subscription code that I had become unfamiliar with overtime to Billing Lib 4 quite easily with your video. A lot of nasty legacy code to the bin..!
this is really great tutorial for Inapp billing Lib v4
Very good and detailed tutorial. I have one comment though.
From what you have accomplished here it is clearly visible that Firebase service, which is paid service in BLAZE plan after all, is not needed at all. Its whole functionality is just to log the purchases. Probably Firebase (or other external backend server) is needed when handling the subscriptions, but this type of purchase you haven't dealt with in this video. Am I correct?
Although it is very good to learn how to work with the backend server anyway 🙂
As i understand, we need to give item to user instead of toast message. Question is... If I have 2+ different products, how can I figure out which product the user bought?
Hello, all you have to do is to loop through all the product ids that was processed in the verifyPurchase() method:
AcknowledgePurchaseParams acknowledgePurchaseParams = AcknowledgePurchaseParams.newBuilder().setPurchaseToken(purchase.getPurchaseToken()).build();
billingClient.acknowledgePurchase(
acknowledgePurchaseParams,
new AcknowledgePurchaseResponseListener() {
@Override
public void onAcknowledgePurchaseResponse(@NonNull BillingResult billingResult) {
if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
for(String sku: purchase.getSkus()) {
Log.e("MainAct", "Product ID" + sku);
}
}
}
}
);
@@CodeibleThank you so much.
Please tell us how to migrate your code to the new version 5
Nice explanation with few words and more actions.
Thank you so much, clear explanation :D
Does this method detect refunded one-time purchases as not purchased?
I did it, but List return null. List is empty. Please help
What if someone doesn't have a back-end server, they just have a simple app/game & want to integrate IAPs?
This tutorial helped me alot, thank you! Very well made. I´m new to programming so i have a question, i want to give my users coins via purchases. so i put the method to collect coins into the onPurchaseUpdated method (hope thats right). It works with one InApp Item, but if ill add another i dont know where to put in the collectable coins.. :/ i´ve put the second item into the getProductDetails method and made a new textView, Button and itemInfo for it (again, hope thats the correct way). how can i get different items for different purchases?
Thanks for turtorial. I do not wanna see "You already have this item" with out backend service. What can i do for that?
Hello, If the purchase was not acknowledged yet, you just have to wait 3 minutes and that message will go away.
Or if you want to test purchasing an item multiple times, use consumeAsync() instead.
How could I remove ads for subscription and non-consumable for may App??
Please make a tutorial
Very good explanation, subbed
Question, you are not utilizing the base64Key public key to sign your purchases? Isnt that required to ensure they are Prod transactions?
Very good
Hi great tutorial everything is very clear, thanks!, I am facing a problem that the products do not show on the activity, Did exactly the same as you did, I do not have any errors either, what can I do?
Hi, thanks. What do you mean by activity?
Can you do a part two that uses a mysql server for verification? My goal (and I'm sure the same can be said for others) is max ROI, using firebase pay as you go can eat into that ROI. If a user owns their own server(s), then by using php scripts to communicate with the MySql database, that work can be done with owned resources and cut out third party services. Great video and easy to follow!
i can help you
Excellent. One question, can this be used for subscriptions?
Thank you. This is mainly for In-App products. For subscriptions, it requires some modifications and additional steps.
A video on that will be released soon.
@@Codeible I'm waiting for it
@@Codeible Hi, im waiting your video. Thanks for sharing.
@@Codeible I'm waiting for it. Please upload
@@nikharsachdeva9600 like the video
Sometimes my purchases can't be consumed... usualy when i make first purchase after cold starting app. Any idea? Logs says:
W/BillingHelper: Couldn't find purchase lists, trying to find single data.
W/BillingHelper: Received a bad purchase data.
W/BillingHelper: Couldn't find single purchase data as well.
Im change function server to nearest to me, and increase timeup... Also make triple answer from server with short pause to be shure... Now... Loks like every purchase will consume... but i still think that this function far from perfect... (
Can we use AWS cloud in place of GCP in this RTDN integration. I never integrated aws before with google play billing system . To configure Google Cloud Pub/Sub we set up the project_id, subscriber, and the topic from the developer console in it. But I dont know how do I set up these parameters in AWS cloud function for RTDN integration
thank you for this tutorial, but i guess other tutorial is not including setup a firebase or backend.
so I wonder about what is different between using firebase and not. can you help me? or am I confused?
Hello, you do not need to use Firebase.
The purpose in this case is to verify the purchase and make sure the purchase is valid.
@@Codeible ok thank you so much, i hope you're happy
why it was automatically refunded within 3days.? is there any issues with Acknowledging?
Hey there thanks it worked and how can i verify that they have purchase a subscription at the start of the app
Will it work fine without creating a Cloud Function Project ?
Great, thank you.
@Codeible hi, great video, I have a problem that checks are not displayed in firebase, could you upload the json code file somewhere?
Question, how do you verify if this transaction is a Production request vs lets say a "sandbox" request when testing?
Thanks!
Hi, I've two questions. 1: How to handle purchase state - PENDING?, 2: what is purchase state UNSPECIFIED_STATE? Thank you for tutorial.
Does that work in c++ too?
do we really need this RTDN service in google play billing integration
Thanks a lot for this video ! I just did not understand in what part of the process you handle the product to the user.
For instance, if I offer a simple purchase to remove ads from the app, based on a user profile param (e.g. boolean isPremium = true), where do I set the "isPremium = true", and also how do I retrieve the item that got purchased that was made ?
Thanks in advance :)
Sir , when will you upload the subscription video ?
Hello, next week.
When will be the tutorial about subscriptions?
i have a question! how do i consume a purchase that consists of consumable and non-consumable skus?
Hello, if your app constantly have new products, their info should be stored in a database. Then you will retrieve each product info from the data base.
When the user purchase an item, you will compare the purchased product with all the other products and determine whether they are consumable or non-consumable.
If your app products do not change often and do not want to use a database, then you can put all your product information in the app and do the same.
teaches how to make this in-app play story but in unreal engine I want to create a game with purchases but in unreal for play story
How can I fix this error in functions logs>>> : Value for argument in documentPath must point to a document, but was "purchases/$(purchasesInfo/purchasesToken)" . Your path does not contain an even number of components.
Make sure your values are inside the
` ` and not " "
The ` is the button next to the 1 key.
You have a slash instead of a period.
Here is the correct version.
`purchases/$(purchasesInfo.purchasesToken)`
The `` are template strings in JavaScript. Read more about it here:
www.tektutorialshub.com/javascript/tagged-templates-in-javascript/#:~:text=We%20can%20create%20a%20Template%20String%20in%20JavaScript,sign%20and%20curly%20braces%20%28%20%24%20%7Bexpression%7D%20%29.
Essentially, it is a way to put variables inside a string using ` `
UPDATE: You won't believe it! The one thing that was causing the error is me using ' instead of ` . Code is now running fine. I did one thing after that, close my laptop go for a beer! This is the best tutorial on this subject. Thanks again..
Error: purchase not acknowledeged.refunded all time.
Hello, you need to acknowledge the purchase by calling AcknowledgePurchase or ConsumeAsync()
Nice tutorial, can you also made similar video for subscription purchase and verify.
Volley is sending a request twice.. Please, how will I make it send a request only once
Hello, it is sending the request twice because when the purchase flow UI is closed, it will go back to the app and onResume() will be called which is intended. This will not affect the outcome since it checks to see if the returned JSON object isValid property first before making the acknowledgement.
Thank you man. I hope it doesn't matter as a Purchase is getting duplicated in the firestore database
@@lanreakintayo3443 Nope, it does not matter
Thanks man, I really appreciate it.
Sir, I have a issue, how come the response all get back "isValid":false 33:46 (so can not check the acknowledge.. things)
Hello, if you are getting false every time, you need to check your code.
same thing with me, did you solve it? Because I have recjeck the code I dont see why always retur false in the isValid field.
Find the bug - you must use ` instead '
@@VictorAyalaSpooner
there is a bug, just compare the order:
purchaseToken: req.query.purchaseToken,
orderId: req.query.orderId,
purchaseTime: req.query.purchaseTime,
isValid: false
vs:
"purchaseToken=" + purchase.getPurchaseToken() + "&" +
"purchaseTime=" + purchase.getPurchaseTime() + "&" +
"orderId=" + purchase.getOrderId() ;
it will work, if you do it like that:
"purchaseToken=" + purchase.getPurchaseToken() + "&" +
"orderId=" + purchase.getOrderId() + "&" +
"purchaseTime=" + purchase.getPurchaseTime();
I'm also facing the same problem here. Have u been able to solve it?
Please help:-
how to solve:
BillingClient: Error consuming purchase with token. Response code: 6 and
BillingClient: Error consuming purchase!
I am really confuse right now....
Is that error occurring when you purchase or when you are displaying the item?
i am getting "Service connection is disconnected" -1 error code. Please help
Hi. Great tutorial. My question is that the database rules allow any user to delete or overwrite the database.
Any ideas or help on how to configure the rules to prevent this from happening without affecting the validation of the purchase tokens?
Thanks in advance.
Hello, it depends if you are using authentication with Firebase as well.
You will add the user id to the purchaseToken JSON.
This will be the configuration:
allow update: if request.resource.data.uid == request.auth.uid;
@@Codeible Thanks for the quick reply. The application is very simple, and to use it does not require user authentication. Maybe is there any other way?
@@miguelgomez5529 If data is only being uploaded through Cloud Functions, you can set read and write to false.
This will prevent anyone except Cloud Functions to modify.
@@Codeible Thanks again. I will give a try to your suggestion and happy new year.
For some reason it not letting me reply to your comment :\ The problem is that the textView and the itemName is not changing and I have no indication whats wrong :(
Still on it, if you can throw me a hint 🙌🏻
Hmm pretty hard to tell since I do not see the code, maybe create a new thread and loop to reset the items to see if it updates. This way, it can verify that you are getting the items.
billingflowparam not launch :(
video min: 17:37
Hi, there have been several updates since you made this video, and some functions have been deprecated, but when I call billingClient.queryProductDetailsAsync(...), I get this error "Response Code: SERVICE_UNAVAILABLE, Debug Message: An internal error occurred." . Can't find any solution🙏
very helpful tutorial! How we handle subscription if user cancel it?
quite successful ))))
Upload an video on Subscription please
hello, may i ask a question? Why can't my product/order be consumed? I have tried using acknowledge & consume code, but it doesn't work. after making a purchase, and want to buy the same product again, the message always appears that I already own this item.
Hello, if the product was acknowledged using the acknowledgePurchase() method, it cannot be unlocked.
@@Codeible I do have the same result, and the reason is that the firebase cloud function always retun isValid false...I have recheck the code and I can not find why...
@@VictorAyalaSpooner
there is a bug, just compare the order:
purchaseToken: req.query.purchaseToken,
orderId: req.query.orderId,
purchaseTime: req.query.purchaseTime,
isValid: false
vs:
"purchaseToken=" + purchase.getPurchaseToken() + "&" +
"purchaseTime=" + purchase.getPurchaseTime() + "&" +
"orderId=" + purchase.getOrderId() ;
it will work, if you do it like that:
"purchaseToken=" + purchase.getPurchaseToken() + "&" +
"orderId=" + purchase.getOrderId() + "&" +
"purchaseTime=" + purchase.getPurchaseTime();
@Victor Ayala Spooner, I'm also facing the problem. Have u been able to resolve the issue?
hey man, could you plase make a tutorial about subscriptions? I´ll pay you
@codeible, the response from the server is giving me False, so, I'm not able to acknowledge the purchase. Also, in the firestore database, it's only one item I found there after storing more than one item
Hello, can you put your Cloud Functions code here?
@@Codeible RUclips is hiding my comment.. Is there another way I can send the code to you?
@Codeible, RUclips has been deleting the code. I don't know if there is another means for me to send the code to you
Hey, I have a question where can we add the logic that after a one-time purchase it is to unlock, for example, a button?
If I am understanding you correctly, you are talking about consuming it so you can purchase the item again?
If so, you put it after your purchases was verified.
@@Codeible The point is for the user to buy once and have it unlocked forever.
@@bartomiejsiewierski9712 i think u must store you purchase list somewhere... in sqlite database may be... or you can use shared prefferences. Or you ask about how to restore purchase... after reinstal programm? i think you must sincronise purchase on you server for this feature...
@@jorji3p577
From what I understand, Cloud Firestore should be responsible for it only the problem is that after buying nothing in Cloud Firestore and looking at Functions -> Logs it displays "Function execution took 335 ms, finished with status: 'crash' "
Maybe someone has a think how to fix it?
@@Codeible I fixed writing JSON object but still have problem unlocking button. Pleas ,could you tell me where to put the logic after the purchase?
Thanks for the video sir!
I have a problem, I created 4 app dummy, they have exactly the same code (literally I copy-paste). But 2 can launch the google play purchase, while the others 2 cannot.
Please, do you know how to solve this issue?
Did you import Google Play Billing in all 4?
@@Codeible Yeah i did. I found the issue, my android billing always return 0 skuDetails. I already added skuList in android studio & product in google play console.
@@tokosuburselalu8689 Ok
hello, thank you for this tutorial, how about subscriptions, how can we know if a user has been subscribed "lets say for a premium account" or not without a cloud functions or an external servers???? in in-app billing V3 ( Boolean b = bp.getSubscriptionListingDetails("productId").purchaseInfo )
It work, but there some problem, when user re-install the app, they have to buy again
It that happens in test mode.
Make a video on same topic but with multiple items and by using google billing v5+
Hey I need help. I have done everything you did until 32:38. I opened cloud firestore and couldn't find the transaction. Can you help me ?
Hello, did you change the Firestore rules so you can add data to Firestore? 31:52
@@Codeible yes I did that
@@Codeible i purchase the product and go to firestore database and under data there is no purchases and the purchase receipt like in the video why is that ? Help ?
@@ChillHouseMusic Hello, to debug your code, manually create the URL with your Cloud Functions request URL and then try it on the browser.
Example: ?purchaseToken=123&orderId=123&purchaseTime=0
You can try using this URL:
us-central1-playbillingtutorial.cloudfunctions.net/verifyPurchases?purchaseToken=123&orderId=123&purchaseTime=0
It will give you a JSON object back.
Let me know the update.
@@Codeible I got "Error: could not handle the request"
"The item you requested is not available for purchase"
Please, how am I going to solve this issue? I've checked stackoverflow and I've followed all the steps needed. Yet, It is still bringing out this same error message
Hello,
1) Add the account you are using for the test in the Google Play Console
2) Uninstall the app on the device
3) Go to the app settings on the phone and clear all the data/cache for the Google Play app
4) Go to the Google Play App and log in with the testing account you added on the Google Play Console
5) Run the app again
Extra: Make sure the device has the Google Play app.
I've done what you said I should do, but the error persists
@@lanreakintayo3443Did it work before? and then this issue occur?
It didn't work at all.. But the products were able to load from the google play console
@@lanreakintayo3443 Ok.
Are you using the emulators? It happens sometimes when you are using the emulators - simple fix should just be emptying the memory and cache from the Google Play App.
Try on a phone first to see if it is working properly. Then:
1) Rebuild the project with a different version code and upload a new release.
2) Repeat the steps from earlier, but this time, run the new version first then uninstall it manually on the emulator.
what a great tutorial, thanks for the info :D
You are not correctly verifying the in-app purchase. You should call the Google API to check if the purchase token is valid. When you not check this, I can send random tokens to your backend, and it responds that the purchase is valid.
ya.. I was also thinking about that.....
🧡🧡🧡🧡🧡
Please Upload an video on Subscription... we are waiting...💖💖💖💖💖💖💖💖💖💖💖💖💖💖
Hi 😊🎉 38:28
Can we use AWS cloud instead of firebase
Yes
@@Codeible could you please eloborate how do we integrate aws cloud function for RTDN with google play billing.
@@akashdeepkashyap9806 The concept is the same as Firebase, you'll need to use AWS Lambda + API Gateway for the API logic and maybe AWS RDS for data storing.
1. Create AWS Lambda functions that accept incoming data and store it in a database like RDS
2. Create API using API Gateway
3. When the API is called, it'll trigger the Lambda and then everything is similar to Firebase.
@@Codeible As In FireBase Integration we setup our application in it. Now my ques is how this API gateway's API will be triggered if we go with your API-gateway & lambda function approach .
@@akashdeepkashyap9806 The same way as in the video.
Once you have the API, you call it.
Is it good for google play billing v5?
please help
The concept is similar with minor adjustments
@@Codeible can you tell me the changes please...
@@Rohan_is_discovering Sure, this post gives all the code changes.
developer.android.com/google/play/billing/migrate-gpblv5
does not save data in firestore
How much Google charges for InApp purchases?
As of January 1, 2022, that service fee is equivalent to:
For developers who are enrolled in the 15% service fee tier, the service fee is:
15% for the first $1M (USD) of earnings each year,
30% for earnings in excess of $1M (USD) each year.
For developers who are not enrolled in the 15% service fee tier, the service fee is 30%.
For automatically renewing subscription products purchased by subscribers, the service fee is 15%.
support.google.com/googleplay/android-developer/answer/112622?hl=en
Good afternoon.
Tell me why all payments are returned after three days
Hello, payments may be returned after 3 days if you have not acknowledged the payments.
@@Codeible Right. Question. In the video, the payment confirmation code was described?
@@ЕвгенийВорожбянов-г7б Yes,
@@Codeible As I understand it, what you wrote in onResume is payment verification
@@ЕвгенийВорожбянов-г7б You need to do it in the onPurchasesUpdate callback
Video reach is 200 like
Can you provide source file of this please
Hello, you can download the project here: codeible.com/coursefiles/googleplayinapp
can you please create a subscription?
Pleaseee, make the subs video
like the video
doesnt work at all
Yuck, Java
I wonder if keep acknowledge code in client side. it possible that someone could prevent acknowledgePurchase() ( reverse engineering ) they could easily get refund and the server considers them as a legit purchase.
why the toast message not show in onAcknowledgePurchaseResponse ? thank you
Oh, that is because the toast is overridden by the purchase flow. You can use Log to display message in console.
@@Codeible thank you !