I'm working on setting up my back end server. However, I'm getting weird results within the Sandbox environment. When I call the verifyReceipt, I get results back, however now matter how long it's been, I always get the same results. The entries I'm looking at are:
status (always returns 0)
pending_renewal_info.auto_renew_status (always returns 1)
latest_receipt_info.expires_date_ms (always returns the original expires date from when the subscription was first started)
I have an endpoint that accepts the server-to-server notifications, however it doesn't seem to be getting called at all. The workflow that I'm using is:
1. User clicks subscribe and completes entries
2. App receives receipt and sends it to the backend server.
3. BE Server calls verifyReceipt. If receipt is verified it information is written to database and confirmation is sent to the app
4. App calls finish transaction
If endpoint is called...
1. BE Server parses body and pulls out latest_receipt
2. latest_receipt is sent to /verifyReceipt
3. If receipt is verified, information is written to the database
I also have a cron job that checks for expired subscriptions and calls verify on them to make sure a notification wasn't missed somewhere. (Currently, I'm calling it manually but it will run nightly in production)
1. Service queries for subscriptions that are active but expired date is earlier than current date
2. For each entry, gets latest_receipt and calls verifyReceipt
3. If receipt is valid, updates the database with the new entries (I currently only update the latest_receipt, auto_renew_status and the expires_date_ms
4. If subscription is expired, service sends a data message to app to update (app also updates whenever it starts).
Whenever I call the verifyReceipt, I always get the same values back no matter how long it's been since the subscription was started. Is this a sandbox issue or am I doing something wrong?