Search code examples
in-app-purchase

what should I do when user upgrade subscribe in apple app purchase


Now when user upgrade the auto renew subscribe product in apple app purchase, the apple server will send a DID_CHANGE_RENEWAL_STATUS message to my develop server. Now I am received the message successfully. But I did not know what should I do to handle the DID_CHANGE_RENEWAL_STATUS message properly. I read the doc and search from internet and tell me the apple will take effect the new upgraded subscribtion the next period. what should I do when received the DID_CHANGE_RENEWAL_STATUS message?

I have think one way that save the new upgraded subscribe record and mark the new subscribed record not valid until recieved switch message from apple server. should I do it like this?

now I am get the subscribe product by using product id and expire date, I must add another field to mark the new upgraded product not valid. I just want to know how to handle the DID_CHANGE_RENEWAL_STATUS message the best way. The same as downgrade auto renew product, any suggestion is appriciate.


Solution

  • This event is only telling you that the product_id will change.

    As you said, in case of an up-grade/cross-grade, it will change right away. In case of a down-grade it will change at the next expires_date.

    To know if you should change the current product associated to your user, look into the last element of the latest_receipt_info (ordered by web_order_line_item_id) and check the product_id. If its value match the upgraded product, you should change, otherwise no.

    If it didn't change, you'll get the new product:

    • in case of an up-grade/cross-grade: an INTERACTIVE_RENEWAL S2S will succeed to the DID_CHANGE_RENEWAL_STATUS (and you'll have to check the latest_receipt_info.product_id property, as described before)
    • in case of down-grade: since the expires_date will be past, you'll need to check with the /verifyReceipt API if the subscription has been renewed. By looking to the product_id property, you'll detect the down-grade.