Receipt validation on iOS In-App-Purchase returns multiple transaction

后端 未结 2 1832
终归单人心
终归单人心 2021-02-06 18:37

In-app purchase on sandbox mode returns multiple transactions on same product id.

Language Used: Swift 4.0

func validateAppReceipt(_ receipt: Data) {
            


        
2条回答
  •  孤城傲影
    2021-02-06 19:07

    I think you have implemented auto renewable in app purchase. Your response is proper.

    Why I am getting multiple transaction on same ID

    As in your response transaction performed for auto renew product at every 5 minutes(Sandbox environment renew product in 5 minutes instead of 1 month in App Store).

    Whether this response is correct or not

    Yes

    If it is correct, which ID to validate

    You have to get all the transaction for your product id tfc.premium.subscription and then grab last object and use it as your latest/last transaction.

    Read this Apple Document for proper understanding.

    The behavior of auto-renewable subscriptions differs between the testing environment and the production environment.

    In the testing environment, subscription renewals happen at an accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day. This enables you to test how your app handles a subscription renewal, a subscription lapse, and a subscription history that includes gaps. See Testing Auto-Renewable Subscriptions in the In-App Purchase Configuration Guide for iTunes Connect to learn about the subscription durations for testing.

    Because of the accelerated expiration and renewal rates, a subscription can expire before the system tries to renew the subscription, leaving a small lapse in the subscription period. Such lapses are also possible in production for a variety of reasons—make sure your app handles them correctly.

提交回复
热议问题