Hi, thanks for the library.
I would like to test subscribe, I try to use this
String product_id = "android.test.purchased";
bp = new BillingProcessor(this, null, this);
bp.subscribe(MainActivity.this,product_id);
but for some reason this does not work, I get an error in the google play dialog [This app version is not set up for Google Play billing].
this problem does not happen when I use
bp.purchase(MainActivity.this,product_id);
Am I doing something wrong?
I'm using android 5.0
Thanks!
EDIT1: This works normally when I use a product_id of a real product created in the google play console, but I'd like to test some logic before, can not test subscribe as purchase?
EDIT2: I've finally found a way to do this, if you need to look at: https://developer.android.com/google/play/billing/billing_testing.html
You cannot test subscribe. Only test purchase. This is a limitation of Google in-app billing, not this library. Sorry! Feel free to complain to Google -- maybe they'll change their ways.
Hi, thanks for the clarification, forgive my ignorance, I still do not have years of programming experience, could you let me know if the purchase processes are the same as registration?
In my project, I have code like the following:
billingProcessor.subscribe(activity, subscriptionIdToBePurchased, developerPayload);
@Override
public void onProductPurchased(@NonNull String productId, @NonNull TransactionDetails transaction) {
logD("Product successfully purchased from Google for userID = %d. Will soon POST membership update. %nproductId = %s %ntransaction = %s",
appData.getUserId(), productId, transaction);
postMembershipData(transaction); // POSTs results of purchase to my backend
}
Hello, thank you for the example, I have two more questions, and this must already be beyond the limits of my ignorance (please forgive me again).
What is developerPayload?
How can I allow the benefits of a subscription made on android on ios? Which logic should I use? (I have not started to develop for ios yet) but I intend to do it next month. thank you!
developerPayload is optional. You don't need it.
iOS and Android are entirely different.
I suggest reading the IAB docs and asking questions on Stack Overflow. Good luck!