Looks like the Great Firewall or something like it is preventing you from completely loading www.skritter.com because it is hosted on Google App Engine, which is periodically blocked. Try instead our mirror:

legacy.skritter.cn

This might also be caused by an internet filter, such as SafeEyes. If you have such a filter installed, try adding appspot.com to the list of allowed domains.

Subscription Endpoint

Subscriptionss store all the info about the state of the user's payment state. Use this endpoint if you would like to:

  • Show account information like when it will expire or which service the account is currently subscribed to.
  • Set or cancel Google Play subscriptions (Apple and Skritter subscription manipulation not supported currently).
GET http://beta.skritter.com/api/v0/subscriptions/(id)

Parameters

  • fields comma-separated list of Subscription properties to return.
    (default: all)

Response

  • Subscription
    The Subscription object for the given User id. Only the Subscription of the currently logged in User is accessible.
PUT http://beta.skritter.com/api/v0/subscriptions/(id)

Edits the Subscription properties. Currently only allows setting, crediting, and cancellation of subscriptions through Google Play.

Input

One Subscription object with the parameters you would like to set. You may not edit the gplus_subscription property if the user is currently subscribed through Apple or Skritter; attempting to do so will return an error. So do not allow your users to buy a subscription through Google Play if they already have one through some other service.

Note: this way of subscribing and cancelling is deprecated.

Parameters

Same as GET

Response

  • Subscription
    The Subscription object for the given User id. Only the Subscription of the currently logged in User is accessible.
  • Payment
    The Payment object created if, in the course of setting gplus_subscription, a payment is processed. This will happen if gplus_subscription was false before, and had not been previously used.
  • subscriptionCancelled
    The boolean that is true if the Google Play Subscription that had been set was cancelled. Once this happens, any attempt to set the same token back to a Subscription will fail silently (gplay_subscription will remain false).
POST http://beta.skritter.com/api/v0/subscriptions/(id)/anet/subscribe

Subscribes the user through Authorize.Net. Also charges the user if the account is expired.

Input

  • plan
    One of 'one_month', 'six_months', 'twelve_months', or 'twenty_four_months'
  • cardNumber
    (string, required, between 13 and 16 digits long)
  • cardMonth
    (integer, required)
  • cardYear
    (integer, required)
  • ccv
    (integer, only used if charged)
  • firstName
  • lastName
  • address
  • city
  • state
  • zip
  • country
  • phoneNumber

Response

POST http://beta.skritter.com/api/v0/subscriptions/(id)/anet/cancel

Unsubscribes the user from Authorize.NET.

Response

POST http://beta.skritter.com/api/v0/subscriptions/(id)/gplay/subscribe

Subscribes the user through Google Play.

Input

  • subscription
    One of 'one.month.sub' or 'one.year.sub'
  • package One of 'com.inkren.skritter.chinese' or 'com.inkren.skritter.japanese'
  • token

Response

POST http://beta.skritter.com/api/v0/subscriptions/(id)/gplay/cancel

Unsubscribes the user from Google Play.

Response

Notes Regarding Google Play

Note that, behind the scenes, this endpoint interacts with the Google Play servers directly, checking the current state and modifying it in the case of cancelling. This section specifies how certain behaviors work.


When gplus_subscription goes from false to an object

IF Google Play reports the given package/subscription/token combination exists, and it hasn't been used to credit ANY account yet, a Payment is created and credited for this account.

IF Google Play reports the subscription will NOT be renewed at the end of the time period, the Subscription object does NOT retain the gplus_subscription object.

So, you can PUT a gplus_subscription which has not been used to credit an account but has already been cancelled, and end up with a Payment and no gplay_subscription property in the Subscription. And if you try to set a gplus_subscription object but the returned Subscription object still has false, and no Payment is returned, you can assume that Google Play subscription has already been cancelled and credited and is of no further use.

When gplus_subscription goes from an object to false

The API will always submit a cancel request to Google Play with the gplus_subscription values. There is no response that specifies if the subscription had already been cancelled, so the subscriptionCancelled property only really knows that the message was sent to Google Play. The user who subscribed should receive an email confirming the subscription has been cancelled.

When going from one gplus_subscription to another

There's currently no handling for this case. It's just ignored.

Over time

The Skritter servers will ping the Google Play servers on the status of the subscription whenever the expiry is neared, when the new purchase will be made. If the subscription expiration has moved forward, the account will be credited automatically. If at any time the Google Play servers report that the subscription is no longer auto renewing, or if the subscription ends up being expired for three days or more, the gplus_subscription property will be set to false.