In app purchase consumable product responding error - windows-phone-8

I am developing application with In app feature and need to purchase again and again according to need of user, but the application gets crash when we try to purchase product again with fallowing error message--The original purchase must be reported as fulfilled before you can try to repurchase
I tried using ReportProductFulfillment(pID); but not sure about the position to use this method,
please suggest me what to do?
Note-my product is consumable
Thanks.

Had you used this method?Please try this When receipt came from server(Windows Store).
ReportProductFulfillment(productId);
// Summary:
// Notifies the marketplace that the application has delivered the paid-for
// goods to the user. You cannot repurchase a product until you have confirmed
// its delivery using this method
//
// Parameters:
// productId:
// The ID of the product that has been delivered to the user.
public static void ReportProductFulfillment(string productId);

Related

Google Pubsub - Receive delivery attempt for push subscription

I have a Google cloud function that is being triggered by a Pubsub push subscription.
I wish to know the current delivery attempt of the given message.
In pull subscription it works by setting dead letter topic, however I am not able to get the delivery attempt in a push subscription message attributes. Tried to configure a dead letter topic and delivery_attempt attribute is not in message attributes.
Is there a way to get the delivery attempt parameter in a push subscription?
For push subscriptions, use deliveryAttempt, not delivery_attempt. The documentation calls out this here:
When Pub/Sub forwards undeliverable messages from a push subscription, every message you receive from the subscription includes the deliveryAttempt field.
I am not sure it is possible to get that data explicitly... but I can suggest an idea of a workaround for consideration.
Every time a cloud function is invoked, you can (in your code) create/update a firestore document with some unique id (either a message event id, or some unique business related identifier). That document may have attributes, one of which - is the time and/or the attempt number.
in java you can use a static method of Subscriber class.
for a PubsubMessage message;
com.google.cloud.pubsub.v1.Subscriber.getDeliveryAttempt(message);
As de documentation sais Returns the delivery attempt count for a received PubsubMessage.
Integer maxAttemps = 5;
private void killMessage(Event<String> event, Exception en,
BasicAcknowledgeablePubsubMessage acknowledgeable) {
Integer attemps = Subscriber.getDeliveryAttempt(acknowledgeable.getPubsubMessage());
if(attemps.intValue() < maxAttemps) {
acknowledgeable.nack();
return;
}
sendToErrorQueue(event, en, acknowledgeable);
}
https://googleapis.dev/java/google-cloud-pubsub/latest/com/google/cloud/pubsub/v1/Subscriber.html

Flutter send push notifications using fcm for all devices

How are you guys , my problem that my flutter app is connected to mysql db , when the user is registered a string with the class name is saved to shared preferences and there is a wall to post some posts on it , is there any way to work with fcm bassed on the shared preferences string ? Like if the user has this string and posted let all users with the same string get notifications i hope i could make it more uderstandable but i dont know how ! Thanks
This sounds like a perfect use-case for using topics to target those messages. Step-wise:
Each device subscribes to the topic based on their class. If they can have multiple classes, they'd subscribe to all topics for those classes.
You then send the message to the correct topic for its class, and FCM will deliver it to all devices subscribed to that topic.
As usual, you will need to perform the actual send operation from a trusted environment, such as your development machine, a server you control, or Cloud Functions.
you will get the token id from the device which you can store to the user table so it will use while giving the notification to every device.
For getting the token :
_firebaseMessaging.getToken().then((String token) {
assert(token != null);
setState(() {
_homeScreenText = "Push Messaging token: $token";
});
print(_homeScreenText);
});
this token variable which you can store to the user table and use it while giving the notification to every device.

Waiting for DeleteForgeAppAsync to proceed

I am using the Forge .NET SDK. To clear all appbundles and activities under my Forge App account I call :
await _designAutomation.DeleteForgeAppAsync("me");
Right afterwards I need to (re)create a new nickname for my Forge App then (re)create the needed AppBundle and Activity :
await _designAutomation.ForgeAppsApi.CreateNicknameAsync("me", new NicknameRecord { Nickname = NICKNAME });
await EnsureAppBundle();
await EnsureActivity();
Quite often one of three calls above fails because the Forge App is still being deleted, so for instance there is a conflict for the nickname creation, or the AppBundle/Activity cannot be created.
The Forge documentation at https://forge.autodesk.com/en/docs/design-automation/v3/reference/http/forgeapps-id-DELETE/ says : This may take up to 2 minutes. During this time the app will not be able to make successful requests.
Would not the asynchronous call to DeleteForgeAppAsync have to wait for the deletion to be complete ?
Thanks for your help.
Maxime
You could handle this scenario by doing retries on 409 response following a forge app deletion.
If you want to add more logic around 409 retries you could always also inspect the body.
Per documentation here you’d need to wait a few for the delete action to take effect despite the SDK API appears to be synchronous:
This may take up to 2 minutes. During this time the app will not be able to make successful requests.

Windows Phone 8 Restore In App Purchase on different device

My app is for Windows Phone 8. I don't get in app purchases on other device configured with same account. On the start of app I am trying to restore purchases. Below is the snippet.
var licenses = CurrentApp.LicenseInformation.ProductLicenses;
if (licenses.Count == 0)
{
Logger.Debug("Licenses for MS server is zero.");
return;
}
else
{
string str = string.Empty;
foreach (var item in licenses)
{
str = str + item.Value.ProductId + " ";
}
Logger.Debug("PURCHSE_STORE First call to sync. Product ids found :" + str);
}
I have published app on Windows Phone Store (in hidden mode) and created In App Product PRODUCT_1 with price zero. I have downloaded app on my two test devices DEVICE A and DEVICE B which are configured with same account. Now I made an In App Purchase on DEVICE A for PRODUCT_1 . After some time when I launched app on DEVICE A and DEVICE B, I expect to see PRODUCT_1 in log of both devices. But its only appearing in log of DEVICE A on which I made purchase not on DEVICE B.
Products are 'Consumable' because we are working on WP 8.0 and we need to create monthly and annual passes. As I understand, in WP 8.0 we can't specify duration of Durables. That's why we are using consumables. We are not fulfilling the product till it expires. For example if user has purchased monthly pass we will give him access for a month then we will send fulfillment request so that he can buy again. Every time user try to access restricted content we check if he has already purchased respective pass.
Please help me in properly restoring in app purchases.
You mention that you haven't fulfilled the product, indicating that you are testing this with 'Consumable' products, not Durables.
The Windows Phone Store does not actually support restoration of Consumables, you're expected to track how many "coins" or "gems" the user has purchased through your own means. See Managing App Updates and Versioning: http://msdn.microsoft.com/library/windows/apps/jj206949(v=vs.105).aspx
If you can use a Durable IAP though everything should work fine and the product will appear under ProductLicenses on other phones w/ the same Microsoft account.

RequestProductPurchaseAsync and transaction failures

I'm trying to implement in-app purchases for a Windows Phone 8 app. The docs for RequestProductPurchaseAsync don't exist specifically for the phone. In the Windows Store docs, there's a funny line:
You should treat a success result as indicating the async process
completed without errors. To ensure that the transaction itself was
successful, check the LicenseInformation element in the returned
receipt.
There's no LicenseInformation element (or attribute) in the receipt. There's Receipt, ProductReceipt, and Signature. Question - did anyone work with in-app purchases before? How is transaction failure/cancellation reported?
Got my hands on a real phone.
Cancellation is reported by an async completion (parameters Info, Status) with Status=AsyncStatus.Error, Info.ErrorCode is COMException with HResult=0x80004005 (E_FAIL).
For at least some of the genuine transaction failures (e. g. product ID not found in the catalog), the reported status and HRESULT are the same. I don't think there's a good way to catch a cancellation with the current API. Reporting AsyncStatus.Canceled would be a good idea, but so far it's not implemented.