1<html><body> 2<style> 3 4body, h1, h2, h3, div, span, p, pre, a { 5 margin: 0; 6 padding: 0; 7 border: 0; 8 font-weight: inherit; 9 font-style: inherit; 10 font-size: 100%; 11 font-family: inherit; 12 vertical-align: baseline; 13} 14 15body { 16 font-size: 13px; 17 padding: 1em; 18} 19 20h1 { 21 font-size: 26px; 22 margin-bottom: 1em; 23} 24 25h2 { 26 font-size: 24px; 27 margin-bottom: 1em; 28} 29 30h3 { 31 font-size: 20px; 32 margin-bottom: 1em; 33 margin-top: 1em; 34} 35 36pre, code { 37 line-height: 1.5; 38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; 39} 40 41pre { 42 margin-top: 0.5em; 43} 44 45h1, h2, h3, p { 46 font-family: Arial, sans serif; 47} 48 49h1, h2, h3 { 50 border-bottom: solid #CCC 1px; 51} 52 53.toc_element { 54 margin-top: 0.5em; 55} 56 57.firstline { 58 margin-left: 2 em; 59} 60 61.method { 62 margin-top: 1em; 63 border: solid 1px #CCC; 64 padding: 1em; 65 background: #EEE; 66} 67 68.details { 69 font-weight: bold; 70 font-size: 14px; 71} 72 73</style> 74 75<h1><a href="androidpublisher_v3.html">Google Play Developer API</a> . <a href="androidpublisher_v3.purchases.html">purchases</a> . <a href="androidpublisher_v3.purchases.subscriptions.html">subscriptions</a></h1> 76<h2>Instance Methods</h2> 77<p class="toc_element"> 78 <code><a href="#acknowledge">acknowledge(packageName, subscriptionId, token, body)</a></code></p> 79<p class="firstline">Acknowledges a subscription purchase.</p> 80<p class="toc_element"> 81 <code><a href="#cancel">cancel(packageName, subscriptionId, token)</a></code></p> 82<p class="firstline">Cancels a user's subscription purchase. The subscription remains valid until its expiration time.</p> 83<p class="toc_element"> 84 <code><a href="#defer">defer(packageName, subscriptionId, token, body)</a></code></p> 85<p class="firstline">Defers a user's subscription purchase until a specified future expiration time.</p> 86<p class="toc_element"> 87 <code><a href="#get">get(packageName, subscriptionId, token)</a></code></p> 88<p class="firstline">Checks whether a user's subscription purchase is valid and returns its expiry time.</p> 89<p class="toc_element"> 90 <code><a href="#refund">refund(packageName, subscriptionId, token)</a></code></p> 91<p class="firstline">Refunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur.</p> 92<p class="toc_element"> 93 <code><a href="#revoke">revoke(packageName, subscriptionId, token)</a></code></p> 94<p class="firstline">Refunds and immediately revokes a user's subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring.</p> 95<h3>Method Details</h3> 96<div class="method"> 97 <code class="details" id="acknowledge">acknowledge(packageName, subscriptionId, token, body)</code> 98 <pre>Acknowledges a subscription purchase. 99 100Args: 101 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 102 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 103 token: string, The token provided to the user's device when the subscription was purchased. (required) 104 body: object, The request body. (required) 105 The object takes the form of: 106 107{ 108 "developerPayload": "A String", # Payload to attach to the purchase. 109 } 110 111</pre> 112</div> 113 114<div class="method"> 115 <code class="details" id="cancel">cancel(packageName, subscriptionId, token)</code> 116 <pre>Cancels a user's subscription purchase. The subscription remains valid until its expiration time. 117 118Args: 119 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 120 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 121 token: string, The token provided to the user's device when the subscription was purchased. (required) 122</pre> 123</div> 124 125<div class="method"> 126 <code class="details" id="defer">defer(packageName, subscriptionId, token, body)</code> 127 <pre>Defers a user's subscription purchase until a specified future expiration time. 128 129Args: 130 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 131 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 132 token: string, The token provided to the user's device when the subscription was purchased. (required) 133 body: object, The request body. (required) 134 The object takes the form of: 135 136{ 137 "deferralInfo": { # A SubscriptionDeferralInfo contains the data needed to defer a subscription purchase to a future expiry time. # The information about the new desired expiry time for the subscription. 138 "expectedExpiryTimeMillis": "A String", # 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. 139 "desiredExpiryTimeMillis": "A String", # 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. 140 }, 141 } 142 143 144Returns: 145 An object of the form: 146 147 { 148 "newExpiryTimeMillis": "A String", # The new expiry time for the subscription in milliseconds since the Epoch. 149 }</pre> 150</div> 151 152<div class="method"> 153 <code class="details" id="get">get(packageName, subscriptionId, token)</code> 154 <pre>Checks whether a user's subscription purchase is valid and returns its expiry time. 155 156Args: 157 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 158 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 159 token: string, The token provided to the user's device when the subscription was purchased. (required) 160 161Returns: 162 An object of the form: 163 164 { # A SubscriptionPurchase resource indicates the status of a user's subscription purchase. 165 "countryCode": "A String", # ISO 3166-1 alpha-2 billing country/region code of the user at the time the subscription was granted. 166 "cancelReason": 42, # The reason why a subscription was canceled or is not auto-renewing. Possible values are: 167 # - User canceled the subscription 168 # - Subscription was canceled by the system, for example because of a billing problem 169 # - Subscription was replaced with a new subscription 170 # - Subscription was canceled by the developer 171 "startTimeMillis": "A String", # Time at which the subscription was granted, in milliseconds since the Epoch. 172 "userCancellationTimeMillis": "A String", # The time at which the subscription was canceled by the user, in milliseconds since the epoch. Only present if cancelReason is 0. 173 "priceChange": { # Contains the price change information for a subscription that can be used to control the user journey for the price change in the app. This can be in the form of seeking confirmation from the user or tailoring the experience for a successful conversion. # The latest price change information available. This is present only when there is an upcoming price change for the subscription yet to be applied. 174 # 175 # Once the subscription renews with the new price or the subscription is canceled, no price change information will be returned. 176 "state": 42, # The current state of the price change. Possible values are: 177 # - Outstanding: State for a pending price change waiting for the user to agree. In this state, you can optionally seek confirmation from the user using the In-App API. 178 # - Accepted: State for an accepted price change that the subscription will renew with unless it's canceled. The price change takes effect on a future date when the subscription renews. Note that the change might not occur when the subscription is renewed next. 179 "newPrice": { # The new price the subscription will renew with if the price change is accepted by the user. 180 "currency": "A String", # 3 letter Currency code, as defined by ISO 4217. 181 "priceMicros": "A String", # The price in millionths of the currency base unit represented as a string. 182 }, 183 }, 184 "purchaseType": 42, # The type of purchase of the subscription. This field is only set if this purchase was not made using the standard in-app billing flow. Possible values are: 185 # - Test (i.e. purchased from a license testing account) 186 "priceCurrencyCode": "A String", # ISO 4217 currency code for the subscription price. For example, if the price is specified in British pounds sterling, price_currency_code is "GBP". 187 "linkedPurchaseToken": "A String", # The purchase token of the originating purchase if this subscription is one of the following: 188 # - Re-signup of a canceled but non-lapsed subscription 189 # - Upgrade/downgrade from a previous subscription For example, suppose a user originally signs up and you receive purchase token X, then the user cancels and goes through the resignup flow (before their subscription lapses) and you receive purchase token Y, and finally the user upgrades their subscription and you receive purchase token Z. If you call this API with purchase token Z, this field will be set to Y. If you call this API with purchase token Y, this field will be set to X. If you call this API with purchase token X, this field will not be set. 190 "orderId": "A String", # The order id of the latest recurring order associated with the purchase of the subscription. 191 "developerPayload": "A String", # A developer-specified string that contains supplemental information about an order. 192 "familyName": "A String", # The family name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. 193 "autoRenewing": True or False, # Whether the subscription will automatically be renewed when it reaches its current expiry time. 194 "emailAddress": "A String", # The email address of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. 195 "profileName": "A String", # The profile name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. 196 "acknowledgementState": 42, # The acknowledgement state of the subscription product. Possible values are: 197 # - Yet to be acknowledged 198 # - Acknowledged 199 "priceAmountMicros": "A String", # Price of the subscription, not including tax. Price is expressed in micro-units, where 1,000,000 micro-units represents one unit of the currency. For example, if the subscription price is €1.99, price_amount_micros is 1990000. 200 "kind": "androidpublisher#subscriptionPurchase", # This kind represents a subscriptionPurchase object in the androidpublisher service. 201 "paymentState": 42, # The payment state of the subscription. Possible values are: 202 # - Payment pending 203 # - Payment received 204 # - Free trial 205 # - Pending deferred upgrade/downgrade 206 "autoResumeTimeMillis": "A String", # Time at which the subscription will be automatically resumed, in milliseconds since the Epoch. Only present if the user has requested to pause the subscription. 207 "expiryTimeMillis": "A String", # Time at which the subscription will expire, in milliseconds since the Epoch. 208 "cancelSurveyResult": { # Information provided by the user when they complete the subscription cancellation flow (cancellation reason survey). # Information provided by the user when they complete the subscription cancellation flow (cancellation reason survey). 209 "cancelSurveyReason": 42, # The cancellation reason the user chose in the survey. Possible values are: 210 # - Other 211 # - I don't use this service enough 212 # - Technical issues 213 # - Cost-related reasons 214 # - I found a better app 215 "userInputCancelReason": "A String", # The customized input cancel reason from the user. Only present when cancelReason is 0. 216 }, 217 "profileId": "A String", # The Google profile id of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. 218 "givenName": "A String", # The given name of the user when the subscription was purchased. Only present for purchases made with 'Subscribe with Google'. 219 }</pre> 220</div> 221 222<div class="method"> 223 <code class="details" id="refund">refund(packageName, subscriptionId, token)</code> 224 <pre>Refunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur. 225 226Args: 227 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 228 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 229 token: string, The token provided to the user's device when the subscription was purchased. (required) 230</pre> 231</div> 232 233<div class="method"> 234 <code class="details" id="revoke">revoke(packageName, subscriptionId, token)</code> 235 <pre>Refunds and immediately revokes a user's subscription purchase. Access to the subscription will be terminated immediately and it will stop recurring. 236 237Args: 238 packageName: string, The package name of the application for which this subscription was purchased (for example, 'com.some.thing'). (required) 239 subscriptionId: string, The purchased subscription ID (for example, 'monthly001'). (required) 240 token: string, The token provided to the user's device when the subscription was purchased. (required) 241</pre> 242</div> 243 244</body></html>