Receipt Verification for Auto-Renewable Subscription in iOS - iphone

In my application I am using Auto-Renewable Transection. Now I have some queries in it. I have read steps for receipt verification in Apple Documentation and also refer lot's of blogs but I am not Clear about the following my scenario which I can't get.
i.e I am subscribing for 1 month and after completion of that transection I get receipt of that transection. I am verifying it successfully. Now I need to send receipt parameter to my web service That I am sending If receipt status is '0' mean receipt is verified. Now I want to verify receipt at every time once I am starting of application that receipt is verified or not I yes the send parameter to web services and if not then send false parameter to web service.
1). Is it ok if I save receipt on completion of transection and verify that receipt at every time when app start. But will it work. Will it give me latest parameter in response. i.e if one month completed then expire date and purchase date para change so that will take effect on it.
Please suggest me the best way so That I can continues check the status of receipt and can call web services as best as I can.
Thanks In Advance

Related

During the sandbox payment test, the server performs the order token verification, and the verification fails with an error code of 8

During the sandbox payment test, the server performs the order token verification, and the verification fails with an error code of 8. Because the product is not owned, the consumption or confirmation fails.
May I ask whether the token verification cannot be performed under the sandbox payment test?
Generally erroCode:8 returns due to a user failed to consume or confirm a product because the user does not own the product.
Please check that product is already purchased , if it is already purchased, please check and consume product by calling the consumeOwnedPurchase API to consume the product and send a notification to the Huawei IAP server to update the delivery status ,purchaseToken is passed in the API call request. After the consumption is complete, the Huawei IAP server resets the product status to available for purchase. Then the product can be purchased again.
For more details , please refer the below link:
https://developer.huawei.com/consumer/en/doc/development/HMSCore-References-V5/api-purchase-confirm-for-order-service-0000001051066054-V5

PayPal API, How to manage a no-response scenario?

I am using PayPal REST API to programmatically transfer amount from one PayPal account to other. Suppose my C#.NET program has initiated transfer via PayPal REST API but got disconnected before receiving any response. How to know whether the initiated transfer has either succeeded or not, later when connectivity is available? So that, I can either confirm transfer or can initiate retry.
Or
How should I manage this?
You can use the Instant Payment Notifications to get a notification every time something processes.
Instant Payment Notification (IPN) is a message service that automatically notifies merchants of events related to PayPal transactions.
The IPN isn't always timely, you may want to only fall back on this in the case that you get disconnected. I just checked on my last 50 IPN entries, and the log times for them varied from 10 seconds to 5 minutes (averaged 2 minutes) following the transaction on my web server.
To use the IPN, you just need to setup a URL to accept the notifications and that's where you can do any logic needed / save IPN details to the database.
See also:
IPN Getting Started
IPN Integration Guide
Enabling IPN Messaging on your PayPal Account

iPhone IAP - suspicious receipt is accepted by Apple validation server

We have an iPhone app that offers in-app-purchase (IAP) products. We perform IAP validation through our server that contacts Apple IAP receipt validation server.
We get many transactions using the exact the same receipt. We suspect it is the receipt used by the Russian hacker that managed to bypass Apple IAP validation server on July 2012. Apple validation server approves the receipt, so we currently perform our own check and deny the purchase if the receipt is equal to this receipt.
Has anyone else experienced the same problem? is our assumption true? is there any other way to protect against transactions using this receipt and maybe similar other receipts?
The suspicious receipt starts with the following characters (total 3045 characters):
ewoJInNpZ25hdHVyZSIgPSAiQXBkeEpkdE53UFUyckE1L2NuM2tJTzFPVGsyNWZlREthMGFhZ3l5UnZlV2xjRmxnbHY2UkY2em5raUJTM3VtOVVjN3BWb2IrUHFaUjJUOHd5VnJITnBsb2YzRFgzSXFET2xXcSs5MGE3WWwrcXJSN0E3ald3dml3NzA4UFMrNjdQeUhSbmhPL0c3YlZxZ1JwRXI2RXVGeWJpVTFGWEFpWEpjNmxzMVlBc3NReEFBQURWekNDQTFNd2dnSTdvQU1DQVFJQ0NHVVVrVTNaV0FTMU1BMEdDU3FHU0liM0RRRUJCUVVBTUg4eEN6QUpCZ05WQkFZVEFsVlRNUk13RVFZRFZRUUtEQXBCY0hCc1pTQkpibU11TVNZd0pBWURWUVFMREIxQmNIQnNaU0JEWlhKMGFXWnBZMkYwYVc5dUlFRjFkR2h2Y21s
It's possible that a person is unlocking the in app purchase for his or her friends, or that there is a hacker, or anything. But if you've blocked the receipt, you should be fine unless another receipt pops up with the same problem. I'm currently having a similar problem with receipt verification. For some reason, receipts from Cut the Rope are being verified against my server, but as my server doesn't recognize the product identifier, it doesn't unlock anything.
There really is no way to prevent this from happening as the receipt the hacker used was valid. You can only monitor your database and block problematic receipts as they arise. The only way to automatically prevent this is to block a certain receipt if it is being used many times within a short period of time.

Why we need to store the receipt of In App Payment from Apple to server?

I have tested and seems there is no need to store the receipt to complete the payment flow.
So what is the real purpose of the receipt?
Jailbroken phones are everywhere, and some of them are enabling user to successfully complete in-app purchase without any real connection to Apple server, by replacing original API with dummy one that return fake receipt. By that, you should get the idea already how receipt and the receipt verification is useful.
The point of the receipt is for your server to verify the validity of the transaction with apple should you so desire and, as #Daniel put it short and sweet, book keeping.

Auto renewal verification in app purchase iphone

I am working on one app in which i have implemented the in app purchase and also successfully verified the receipt.
I have done the auto renewal subscription in which I want to know how I can check the user subscription is active or not?
In order to verify the receipt i need the receipt from the SKPaymentTransaction. So my question is that how could I can check when user returns to my app that he still has subscription or it expired.
or simply which method can give me the user transaction property of SKPaymentTransaction on load of my view so i can verify the receipt.
Thanks in advance,
Satish
Finally I did it in the following way...
I save the transaction receipt in userdefaults when user first time subscribes to the subscription and when later I need to check for the subscription activation I use that receipt which tells me the latest expiry day..
Hope this will help...