I was searching for sample of response returned by google billing library and I did not found.
Google returns
1: Response Code: Value is 0 if the purchase was successful, error otherwise.
2: Signature
3: Purchase data subscription contains autoRenewing property while managed product does not.
UPDATE: Android billing library's new version includes acknowledged property. I don't have new response for the product at hand.
Subscription:{
"orderId":"GPA.2023-9153-0180-49403",
"packageName":"com.package.name",
"productId":"subscription.name.sku",
"purchaseTime":1565763897962,
"purchaseState":0,
"purchaseToken":"kkoohioagkpieamagedjoiji.AO-J1Owj3YPtGxM9YOBSCywUo07BwcX79dAS24w7DvvxVi-gEzsXeRvkY5NGETBH8oDUaWc0oF4M8K3EiJ2v9JUfoGzxPazO51qpksIXGOkVPHI0DVJE3FzOdDd7bqbAIPVLFUo7u6SzdN1nRUlg9xoakvzqY8Kwow",
"autoRenewing":true,
"acknowledged":false
}
The old response:
Subscription:
{
"orderId":"string",
"packageName":"string",
"productId":"string",
"purchaseTime":1423956863083,
"purchaseState":0,
"purchaseToken":"apafgjjemjhnoiadmmpffiil.AO-J1OySPl3pYGk4JliUkLj_Fro7FvGWiArPP0R1imx49HOmnJ4MroJNbSwkLk1WfYJmp_8g5ek5C9AAIjG_6GhC03-X0QMwfyc4epN_ZdkZqlxIKj0V5m6QQZDRhLW-8smEQ5R_USG4dtq6JTsK9UoxMO2YFXziGQ",
"autoRenewing":true
}
Products:
{
"orderId":"GPA.6027-7343-7915-33484",
"packageName":"com.app.package.name",
"productId":"quotation.1",
"purchaseTime":1523956202686,
"purchaseState":0,
"purchaseToken":"kjcjjlmljnbifnlpcobchldi.AO-J1OyD96lBh3dYpPpf3yW3H4EzH_2XXFjNjL3jrVf-oPk-T7ZQvf-DF1Zd0LFtzPBn8hqdL_2ML6AXLgzBRkDcFAljIbv4Ck0ARxz-L4LPXAFgQvHGIn4Of00msbbkiI2ENpNKBgd6_MlxT7oTaMU3ltQmld7X2A"
}
Related
I purchase a consumable product with StoreKit 2 using my device with Xcode:
let result = try await product.purchase()
switch result {
case .success(let verification):
switch verification {
case .verified(let transaction):
await transaction.finish() // comes here
...
}
it is successful (I get result with verified transaction in it, my server validates the receipt).
But I can't get any transactions after it (I need it to initiate iOS 15 refund in-app flow), nothing from these works: Transaction.currentEntitlements, Transaction.latest(for: productId), Transaction.currentEntitlement(for: productId) - always nil and []. Even Transaction.updates doesn't emit anything.
The only mention I got is https://developer.apple.com/forums/thread/689480
Any ideas?
I ran into a similar issue with storekit2 and it looks like it’s by design, at least according to this apple response on the dev forums https://developer.apple.com/forums/thread/687199
I haven’t looked if there is a way to do this in the original store kit api.
We have implemented Change notification for Microsoft Teams channel messages and the subscription and renewal worked well. Suddenly we received the following error :
error: {
'InvalidRequest',
message: 'Subscription validation request failed. Response must exactly match validationToken query parameter.',
innerError: {
date: '2020-10-07T06:27:51',
'request-id': '1f5b7190-d2ab-459a-a9de-a086cc1a8584',
'client-request-id': '1f5b7190-d2ab-459a-a9de-a086cc1a8584'
}
}
}
Additionally we are receiving lot of life cycle notification from Microsoft Teams with and its payload is empty.
Any help is much appreciated.
I'd failed to update the managed device category in Intune with Microsoft Graph. With the same code, I'd succeeded to update device owner. Parameter below:
URL: https://graph.microsoft.com/beta/deviceManagement/managedDevices('XXXXXXXXXX')
Failed request body:
{ "deviceCategoryDisplayName": "General Purpose" }
Succeeded request body:
{ "Owner": "Personal" }
"General Purpose" is a custom value. When failed, the server returns an error code and activity id.
How can I fix it?
I've got the answer finally.
We should use odata.id to update the property. Like these,
URL: https://graph.microsoft.com/beta/deviceManagement/managedDevices('XXXXX-YOUR-INTUNE-DEVICE-GUID-XXXXX')
Method: PUT
Payload: {#odata.id: "https://graph.microsoft.com/beta/deviceManagement/deviceCategories/XXXXX-YOUR-DEVICE-CATEGROY-GUID-XXXX"}
Response code: 204
You will receive response code 204 when success to update. And, you cannot update other properties with it. It occurs error.
In the API documentation, it can update with string, but it is not correct. Maybe, it is not string property but refers to other objects. I think other objects referring property are the same, but not tested.
https://techcommunity.microsoft.com/t5/Microsoft-Intune/Update-Intune-Managed-Device-Category-with-Microsoft-Graph-were/m-p/366263/highlight/true#M1683
I'm trying to implement an application with auto-renewable subscription. Users should pay to access all functions of my application. I already use Parse as backend for my application. It provides some API methods for inAppPurchases but there is nothing said about auto-renewable type. The only thing I have found is some two years old threads in the blog it is said that receipt verification was implemented only for downloadable purchases.
I have tried to use as it called in docs "Simple purchase" and it works fine but I can't figure out how can I check if my user already bought subscription or not.
Does anybody know is there way to do it via Parse API or This should implemented in another way?
As mentioned, receipt validation is only built into the Parse SDK for downloadable content, but it is fairly simple to to create a Cloud Code function that POSTs the app receipt to the iTunes Store for validation. Here are the Apple docs for server side validation: Validating Receipts with the App Store
Here is a what a basic function would look like:
Parse.Cloud.define('validateReceipt', function (request, response) {
var receiptAsBase64EncodedString = request.params.receiptData;
var postData = {
method: 'POST',
url: 'http://buy.itunes.apple.com/verifyReceipt',
body: { 'receipt-data': receiptAsBase64EncodedString,
'password': SHARED_SECRET }
}
Parse.Cloud.httpRequest(postData).then(function (httpResponse) {
// httpResponse is a Parse.Cloud.HTTPResponse
var json = httpResponse.data; // Response body as a JavaScript object.
var validationStatus = json.status; // App Store validation status code
var receiptJSON = json.receipt; // Receipt data as a JSON object
// TODO: You'll need to check the IAP receipts to retrieve the
// expiration date of the auto-renewing subscription, and
// determine if it is expired yet.
var subscriptionIsActive = true;
if (subscriptionIsActive) {
return response.success('Subscription Active');
}
else {
return response.error('Subscription Expired');
}
});
});
See Receipt Fields for details on interpreting the receipt JSON. It's fairly straight forward for iOS 7+, but auto-renewing subscription receipts for iOS 6 and earlier are tedious.
How can I check purchase id which was sent by user to me from his orders list?
For example, he can send something like: M1VYXX7VX7 (as written in his purchases list in appstore) and ask to return his purchase (may be he had deleted his app accidentally),
But when I get order information inside of my code (through SKPaymentTransaction) I have no access to that identifier. Then only ID i have looks like: 1000000020706713.
So is there any ways to validate that purchase ID using information which was sent to me by app store?
Thanks.
Read Verifying Store Receipts in the In-App Purchase Programming Guide. According to the documentation:
To verify the receipt, perform the following steps:
Retrieve the receipt data. On iOS, this is the value of the transaction's transactionReceipt property. On OS X, this is the entire contents of the receipt file inside the application bundle. Encode the receipt data using base64 encoding.
Create a JSON object with a single key named receipt-data and the string you created in step 1. Your JSON code should look like this:
{
"receipt-data" : "(receipt bytes here)"
}
Post the JSON object to the App Store using an HTTP POST request. The URL for the store is https://buy.itunes.apple.com/verifyReceipt.
The response received from the App Store is a JSON object with two keys, status and receipt. It should look something like this:
{
"status" : 0,
"receipt" : { (receipt here) }
}
If the value of the status key is 0, this is a valid receipt. If the value is anything other than 0, this receipt is invalid.
Read the article for more details.