Gdx-Pay iOS store, can't find product info - ios

I have a working implementation of gdx-pay for Android using the Google App Store. I did that following this: https://bitbucket.org/just4phil/gdxpayexample/src/.
I am now trying to get it working on iOS, but can't find any docs on how to do that. In the project linked above there is no "ios app store" or any changes made to the ios-project. Does anyone have a link to an example working with ios?
I tried some stuff out and got this far:
IOSResolver:
public class IOSResolver extends PlatformResolver {
public IOSResolver(MyGdxGame myGame) {
super(myGame);
PurchaseManagerConfig config = myGame.purchaseManagerConfig;
initializeIAP(null, myGame.purchaseObserver, config);
installIAP();
}
IOSLauncher:
#Override
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.orientationLandscape = false;
config.orientationPortrait = true;
config.useCompass = false;
config.useAccelerometer = false;
game = new MyGdxGame(new IOSPlatform());
return new IOSApplication(game, config);
}
#Override
public boolean didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) {
boolean finished = super.didFinishLaunching(application, launchOptions);
game.setPlatformResolver(new IOSResolver(game));
return finished;
}
Core:
// ---- IAP: define products ---------------------
purchaseManagerConfig = new PurchaseManagerConfig();
purchaseManagerConfig.addOffer(new Offer().setType(OfferType.ENTITLEMENT).setIdentifier(ios_productId));
This gives me the error:
[GdxPay/AppleIOS] Requesting product info for test.product.id
2017-02-20 16:58:58.089803 IOSLauncher[5611:2144625] [info] gdx-pay: calls purchasemanager.purchase()
[GdxPay/AppleIOS] Error purchasing product (wrong product info count returned: 0)!
com.badlogic.gdx.utils.GdxRuntimeException: java.lang.RuntimeException: Error purchasing product (wrong product info count returned: 0)!
at com.scene2d.space_camp.MyGdxGame$1.handlePurchaseError(MyGdxGame.java)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleProductsDelegatePurchase.didReceiveResponse(PurchaseManageriOSApple.java)
at com.badlogic.gdx.pay.ios.apple.PurchaseManageriOSApple$AppleProductsDelegatePurchase.$cb$productsRequest$didReceiveResponse$(PurchaseManageriOSApple.java)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
at org.robovm.apple.uikit.UIApplication.main(UIApplication.java)
at com.scene2d.tut.IOSLauncher.main(IOSLauncher.java)
Caused by: java.lang.RuntimeException: Error purchasing product (wrong product info count returned: 0)!
... 5 more
I registered the app on iTunes Connect and set up a product. However I did not post binaries, do I need to for testing IAP? It shows this message in iTunes Connect:
Your first In-App Purchase must be submitted with a new app version.
Select it from the app’s In-App Purchases section and click Submit.
Once your binary has been uploaded and your first In-App Purchase has
been submitted for review, additional In-App Purchases can be
submitted using the table below.
Is there no way to test without uploading the actual app?

I had this same issue and was seeing the same error message.
I think the two keys to getting your IAPs work are the following:
Use a real device for testing, not an emulated one.
Sign in with a sandbox account, not a real one.
Create your sandbox account on itunesconnect.
Build your app and install it onto your ipad/iphone using xcode.
On your device, go into settings and logout. This is important.
Run your app and make a purchase. You will be prompted to login. Use your sandbox account.
I did this and it worked.

Related

Apple product list price and purchase dialog price both are showing different

My product list are dynamic, name and price both are coming from app store.
I have only one product and that original app store product price is 9,99€ Tier 8.
await inAppPurchase.queryProductDetails(_kIds).productDetails;
When I get this product in my iOS app at that time product details price is 8,99€.
viewModel
.getInstance()
.buyNonConsumable(purchaseParam: viewModel.initPurchaseProducts())
.whenComplete(() {})
.catchError((onError) {
showToast(Constants.purchaseFail, success: 0);
print("catch error error $onError");
});
When I call buyNonConsumable function then this purchase dialog show 9,99€
I am testing on TestFlight and xCode. The IAP is not on production.
I have used this package : https://pub.dev/packages/in_app_purchase
Dart Version : 2.18.4
Flutter SDK : 3.8.8
Application snap
Does anyone have any ideas about this price difference problem? Any suggestion would be most appreciated.
Thanks in advance!!

A user wants to subscribe to a product using HUAWEI IAP, but the payment page is inaccessible

Public key and AGC configurations are correct, but when a user tries subscribing to a product, error code -1 is returned, and the payment page fails to be displayed.
In this case, check whether the log contains
"errorCode:6". The error code returned to the SDK layer is -1, indicating that the order fails to be created.
public class OrderStatusCode {
public static final int ORDER_STATE_SUCCESS = 0;
public static final int ORDER_STATE_FAILED = -1;
}
Check whether the order creation failure is caused by the server. If not, check whether the product created in the PMS contains invalid fields and whether the product is valid.
Its because you didn't set IAP function yet, you might have missed this step.
In this you can see "IAP function has not been set yet!" and a settings button. Click the settings button to set IAP function for your app.
If you finished it your page will be like this
Now all you have to do is wait for some time around 5 or 10 minutes and IAP can purchased in you app in mobile.

Install the iOS app via Xcode gives old transaction

When I reinstall the app with my subscription secret unchanged ,
let receiptFileURL = Bundle.main.appStoreReceiptURL
let receiptData = try? Data(contentsOf: receiptFileURL!)
let receiptBase64String = receiptData?.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
guard let stringReceipt = receiptBase64String else { return }
Above section of code gives me the old and expired response before installing the new version. I swear whether I have logged in my sandbox account or not, the result gives me the response
transaction_id : 1000000558259116
original_transaction_id : 1000000558239264
productId : YP20190527_3
renewalDict : {
"auto_renew_product_id" = "YP20190527_3";
"auto_renew_status" = 0;
"expiration_intent" = 1;
"is_in_billing_retry_period" = 0;
"original_transaction_id" = 1000000558239264;
"product_id" = "YP20190527_3";
}
What should I do next if I want to simulate a completely new iPhone and proceed purchases? I guess this old response force me prompting the Apple sandbox login for all time
Updates: When I try to ping sandbox.itunes.apple.com , it gives 100% packet loss. When I login my sandbox account at iTunes and App Store Section of my iPhone setting , I cannot login even I have got correct password and email.
Still, the system status of Apple gives available service of Sandbox iTunes User? I am not sure whether my in-app subscription can be tested using sandbox account
https://developer.apple.com/system-status/
While visiting this link with browser, it say Service unavailable
Could you please tell us when I can test the in-app subscription now ?

In-App Purchase Display Name and Description not properly loading - Swift 4

I am trying to enable In-App Purchases in Swift 4 for iOS and I can not get the Display Name and Description to properly show up (or load) in the app when I test. I do get the error handing message that I put in if (products.count == 0) {. I can't get the Product Title and Product Description that I set up in AppStoreConnect to properly load when I test my app. Instead the code thinks that there are no products because it runs the code in the if (products.count == 0) { closure. I quadruple checked everything else (i.e. Bundle ID, Product ID, StoreKit's imported, the delegates are set up, everything on the AppStoreConnect side is set up, etc.). There are no Xcode Warnings and the In-App Purchase status is "Ready To Submit". Any suggestions?
var product: SKProduct?
var productID = "myProductID"
func productsRequest(_ request: SKProductsRequest, didReceive response: SKProductsResponse) {
var products = response.products
if (products.count == 0) {
productTitle.text = "Warning" // GETS DISPLAYED
productDescripton.text = "Unable to connect to In-App Purchase." // GETS DISPLAYED
} else {
product = products[0]
productTitle.text = product?.localizedTitle
productDescripton.text = product?.localizedDescription
buyButton.isEnabled = true
buyButton.alpha = 1.0
}
let invalid = response.invalidProductIdentifiers
for product in invalid {
print("\(product)")
}
}
If you are a rookie at integrating In-App Purchases, then you should read this. If you have clean code and you think that you set everything up properly in App Store Connect, but still can't test properly. Specifically, if your products array is showing empty when it shouldn't be. Then, make sure that you have done the following:
1) Set up a Sandbox Tester via Users and Access in App Store Connect. This needs to be set up with an email that is not already used with iTunes, App Store, or Apple.
2) Filled out all of the necessary forms in Agreements, Tax, and Banking via App Store Connect. You'll know that everything is filled out when Paid Applications shows an Active Status.
3) Are testing on a real device that has been signed out of iTunes and App Store.
Common things that will cause this without warning are:
Your products aren't in the 'Ready to Submit' stage. This is most often from a missing screenshot, which is required even for Sandbox (you can upload a blank image for sandbox testing).
You haven't signed the 'Paid Applications' agreement in App Store Connect
Here's a good blog post that covers everything in a little more detail: Configuring In-app Products is Hard

Unity In-App Purchase Local Validation is slow

I'm currently changing our game's in-app purchasing model from an older add-in to unity's built-in service. Up until now there have been no issues testing payments and validating receipts, both live and using sandbox accounts.
Following the Unity guides I have developed a store, and can successfully make new payments with a sandbox account, however local validation takes around 2 minutes on an iPad Air 2. Is this normal? Our previous add-in validated receipt data using the App Store, and took only a few seconds.
private bool CheckReceipt()
{
#if UNITY_EDITOR
Debug.Log("IAP: Default for editor, receipt valid.");
return true;
#elif UNITY_ANDROID || UNITY_IOS
try
{
CrossPlatformValidator validator = new CrossPlatformValidator(GooglePlayTangle.Data(),
AppleTangle.Data(), Application.bundleIdentifier);
Product product = controller.products.WithID(ProductID);
string receipt = product.receipt;
if (receipt == null)
{
Debug.Log("IAP: No receipt.");
return false;
}
Debug.Log("IAP: Validating receipt...");
IPurchaseReceipt[] result = validator.Validate(receipt);
return result[0].productID == ProductID;
}
catch (IAPSecurityException e)
{
Debug.Log("IAP: Invalid receipt, not unlocking content");
return false;
}
#endif
}
In mode "Sandbox" this time for validation very real, when you change paying to "Battle" mode all stand normal

Resources