[Huawei Developers] Mike-mei:
When you integrate and debug a subscription, HUAWEI In-App Purchases (IAP) can help you simulate the actual environment through sandbox testing.

The purchase process of subscriptions is similar to that of one-time products. However, subscriptions involve more details to consider, such as subscription renewal (successful or failed) and the subscription period. In a sandbox environment, test subscriptions renew much faster than actual subscriptions. For example, when an actual subscription is renewed every week, the test subscription is renewed every 3 minutes.

View attachment 5837903

Renewal period

Next, I'll compare the subscription event notifications in the sandbox environment with those in the actual environment, and clarify the notificationType received in the two environments.

View attachment 5837905

notificationType

Canceling a Subscription​

Test 1: Cancel the subscription before automatic renewal.

View attachment 5837909

Test 2: Cancel the subscription after the subscription expires and is automatically renewed.

View attachment 5837911

Summary: In both the sandbox environment and actual scenario, after a subscription is canceled, the subscription disappears immediately, the subscription fee is returned immediately, and the subscription will no longer be automatically renewed. In the sandbox environment, multiple successful subscription renewal event notifications will be received because the test subscription renews much faster than actual subscriptions.

Pausing a subscription​

View attachment 5837913

In the Actual Environment​

At 14:27 on July 28, I purchased a weekly subscription for the first time. The key subscription event notification 0 was returned, indicating that this was the first time the subscription was purchased.

At 14:28 on July 28, I canceled the subscription. The key subscription event notification 5 was returned, indicating that the subscription was terminated.

At 14:29 on July 28, I resumed the subscription. The key subscription event notification 6 was returned, indicating that the subscription was resumed.

At 14:29 on July 28, I set a suspension plan for the subscription lasting one week. The key subscription event notification 11 was returned, indicating that the suspension renewal plan was set (including the creation and modification of the suspension plan and the termination of the suspension plan before it takes effect).

At 13:27 on August 5, the subscription that was purchased on July 28 and expired on August 4 entered the suspension period. The key subscription event notification 10 was subsequently returned.

At 09:17 on August 8, I resumed the subscription. At this time, the subscription had expired and the key subscription event notification 3 and 6 were returned. 3 indicates that the expired subscription was resumed, and 6 indicates that the subscription renewal was resumed.

In the Sandbox Environment​

At 10:17 on September 20, I purchased a half-year subscription for the first time. The key subscription event notification 0 was returned, indicating that this was the first time the subscription was purchased. This is reflected in the actual environment.

At 10:18 on September 20, I canceled the subscription. The key subscription event notification 5 was returned, which is reflected in the actual environment.

At 10:19 on September 20, I resumed the subscription. The key subscription event notification 6 and 7 were returned, while only 6 was returned in the actual environment. This was due to sandbox settings and did not affect the actual environment.

At 10:19 on September 20, I set a 25-minute suspension plan. The key subscription event notification 11 was returned, indicating that the suspension renewal plan was set (including the creation and modification of the suspension plan and the termination of the suspension plan before it takes effect). At 11:17, the subscription expired and entered the 25-minute suspension period.

During suspension, the key subscription event notification 10 was not returned in the sandbox environment because the subscription suspension and expiration events were detected on a daily basis. The sandbox testing period was short and the suspension period had already ended when the status was detected the next day, so no key subscription event notification 10 was returned. However, in the actual environment, notification 10 would be returned.

At 11:25 on September 20, the subscription was still suspended, so I manually resumed subscription renewal. The subscription key event notification 3 and 6 were returned, reflecting that in the actual environment.

The subscription was automatically renewed every half an hour.

References​

In-App Purchases official website

In-App Purchases development guide