AI-generated Key Takeaways
- 
          The purchases.subscriptions.defermethod is used to defer a user's subscription purchase to a future expiration time.
- 
          This method requires specifying the package name, subscription ID, and purchase token in the request URL. 
- 
          The request body includes deferralInfowith theexpectedExpiryTimeMillisanddesiredExpiryTimeMillisto control the deferral.
- 
          The response body contains the newExpiryTimeMillis, indicating the updated expiry time of the subscription.
- 
          The https://www.googleapis.com/auth/androidpublisherOAuth scope is required for authorization.
- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- SubscriptionDeferralInfo
- Try it!
Defers a user's subscription purchase until a specified future expiration time.
HTTP request
POST https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}:defer
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
| packageName | 
 The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). | 
| subscriptionId | 
 The purchased subscription ID (for example, 'monthly001'). | 
| token | 
 The token provided to the user's device when the subscription was purchased. | 
Request body
The request body contains data with the following structure:
| JSON representation | 
|---|
| {
  "deferralInfo": {
    object ( | 
| Fields | |
|---|---|
| deferralInfo | 
 The information about the new desired expiry time for the subscription. | 
Response body
Response for the purchases.subscriptions.defer API.
If successful, the response body contains data with the following structure:
| JSON representation | 
|---|
| { "newExpiryTimeMillis": string } | 
| Fields | |
|---|---|
| newExpiryTimeMillis | 
 The new expiry time for the subscription in milliseconds since the Epoch. | 
Sample
The following is a sample request:
curl -X POST \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "deferralInfo": { "desiredExpiryTimeMillis": "1735689600000", "expectedExpiryTimeMillis": "1704067200000" } }' \ 'https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.example.myapp/purchases/subscriptions/monthly.premium.v1/tokens/aBcDeFgHiJkLmNoPqRsTuVwXyZaBcDeFgHiJkLmNoPqRsTuVwXyZ.1234567890:defer'
The following is a sample response:
{ "newExpiryTimeMillis": "1776004800000" }
Authorization scopes
Requires the following OAuth scope:
- https://www.googleapis.com/auth/androidpublisher
SubscriptionDeferralInfo
A SubscriptionDeferralInfo contains the data needed to defer a subscription purchase to a future expiry time.
| JSON representation | 
|---|
| { "expectedExpiryTimeMillis": string, "desiredExpiryTimeMillis": string } | 
| Fields | |
|---|---|
| expectedExpiryTimeMillis | 
 The expected expiry time for the subscription. If the current expiry time for the subscription is not the value specified here, the deferral will not occur. | 
| desiredExpiryTimeMillis | 
 The desired next expiry time to assign to the subscription, in milliseconds since the Epoch. The given time must be later/greater than the current expiry time for the subscription. |