Link

Subscriptions

A subscription is a particular subscriber’s access to a subscription plan. It will typically have a start date, and an end date, and may recur at some period. A subscription may have an external id if it came from an earlier CMS, which must be unique. Payment is required to create a subscription.



POST Preview subscription

It returns a preview for a Subscription, without creating a new subscription.

Arguments
key required
The account key
accesstype_jwt required
Used to identify loggedin user. This is the authorized user jwt
subscription_plan_id required
Id of the subscription plan for which subscription is to be previewed
payment required
Consists of payment details. payment_type can be one of Payment Types . amount_cents is the payment transaction amount in cents . amount_currency is payment transaction amount currency.
subscription_type optional
Type of subscription. Can be one of Subscription Types . Defaults to standard
coupon_code optional
Voucher code to be applied
metadata optional
Data that needs to be associated with subscription.
notes optional
Notes that needs to be associated with subscription.
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions/preview?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns a subscription object and below additonal details.

attempt_token string
It is the identifier of a subscription attempt. It should be sent back with create subscription api to mark an attempt as success.
external_reference_id string
It is the identifier of payment order created with the Payment gateway. It should be used by the client to make payment.

POST Create subscription

Used to create a subscription.

Arguments
key required
The account key
accesstype_jwt required
Used to identify loggedin user. This is the authorized user jwt
attempt_token required
Attempt token received from subscription preview
subscription_plan_id required
Id of the subscription plan for which subscription is to be created
payment required
Consists of payment details. payment_type can be one of Payment Types . amount_cents is the payment transaction amount in cents . amount_currency is payment transaction amount currency. payment_token is the payment transaction id received from the payment gateway.
subscription_type optional
Type of subscription. Can be one of Subscription Types . Defaults to standard
coupon_code optional
Voucher code to be applied
metadata optional
Data that needs to be associated with subscription
notes optional
Notes that needs to be associated with subscription.

The request body is required to be same as that required for preview, with additional payment details and attempt_token.

  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "attempt_token": "WnwxA2AVrE3xqcDUqrSb3sNm",
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR",
          "payment_token": "pay_afddsgsdfg"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns subscription object.


GET all subscriptions

This API will list out all the subscriptions for a subscriber.

Arguments
key required
The account key
accesstype_jwt optional
Used to identify loggedin user. This is the authorized user jwt
  $ curl -X GET 'https://accesstype.com/api/access/v1/members/me/subscriptions?key=<key>&accesstype_jwt=<accesstype_jwt>'
Returns

This returns an Array of subscription objects.


PUT Cancel a subscription

This API can be used to cancel a subscription

Arguments
key required
The account key
accesstype_jwt optional
Used to identify loggedin user. This is the authorized user jwt
subscription-id required
Id of the subscription to be cancelled.
  $ curl -X PUT 'https://accesstype.com/api/access/v1/members/me/subscriptions/<subscription-id>/cancel?key=<key>&accesstype_jwt=<accesstype_jwt>'
Returns

This returns empty body.


PATCH Update a subscription

This API can be used to update the metadata for a subscription.

Arguments
key required
The account key
accesstype_jwt optional
Used to identify loggedin user. This is the authorized user jwt
subscription-id required
Id of the subscription to be updated.
metadata required
Metadata of the subscription to be updated.
  $ curl -X PATCH 'https://accesstype.com/api/access/v1/members/me/subscriptions/<subscription-id>?key=<key>&accesstype_jwt=<accesstype_jwt>' -d {
    "subscription": {
      "metadata":  {
          "full-name": "hello-world",
          "email": "hello@quintype.com"
      }
    }
  }
Returns

This returns empty body.


Gift Subscriptions

POST Preview subscription for gifting

It returns a preview for a Subscription, without creating a new subscription. To be used when subscription is to be gifted.

Arguments

Below arguments need to be passed in addition to subscription preview arguments

recipient_subscriber required
Object having recipient_identity_provider and recipient_identity_provider. The recipient subscriber should not be same as the gifter
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions/preview?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "recipient_subscriber": {
    "recipient_identity_provider": "email",
    "recipient_identity": "friend@example.com"
  },
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns a subscription object and additonal details similar to subscription preview response


POST Create subscription for gifting

Used to create a gift subscription.

Arguments

Below arguments need to be passed in addition to subscription create arguments

recipient_subscriber required
Object having recipient_identity_provider and recipient_identity_provider. The recipient subscriber should not be same as the gifter.
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "recipient_subscriber": {
    "recipient_identity_provider": "email",
    "recipient_identity": "friend@example.com"
  },
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns a subscription object.


GET subscription gifts

Used to list subscriptions gifted by a user

Arguments
key required
The account key
accesstype_jwt optional
Used to identify loggedin user. This is the authorized user jwt
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscription-gifts?key=<key>&accesstype_jwt=<accesstype_jwt>'
Returns

This returns an array of subscription objects.


Pay Per Asset Subscriptions

POST Preview Pay per asset subscription

It returns a preview for a Subscription, without creating a new subscription. To be used to preview Pay Per Asset subscription.

Arguments

Below arguments need to be passed in addition to subscription preview arguments

dynamic_assets required
Array of objects containing id of the asset to be purchased. This would be story-id if a story is the asset to be purchased.
type required
Its value must be dynamic_assets
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions/preview?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      },
      "dynamic_assets": [{
        "id": "some_asset_id"
      }]
    }
}
Returns

This returns a subscription object and additonal details similar to subscription preview response


POST Create Pay per asset subscription

Used to create Pay Per Asset subscription using micro payments.

Arguments

Below arguments need to be passed in addition to subscription create arguments

dynamic_assets required
Array of objects containing id of the asset to be purchased. This would be story-id if a story is the asset to be purchased.
type required
Its value must be dynamic_assets
  $ curl -X POST 'https://accesstype.com/api/access/v1/members/me/subscriptions?key=<key>&accesstype_jwt=<accesstype_jwt>'-d {
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      },
      "dynamic_assets": [{
        "id": "some_asset_id"
     }]
    }
}
Returns

This returns a subscription object.


Subscription without login

POST Preview subscription without login

It returns a preview for a Subscription, without creating a new subscription. It is to be used when user is not logged in and hence accesstype_jwt is not present.

Arguments

Below arguments need to be passed in addition to subscription preview arguments. accesstype_jwt is not required.

emailAddress required
Used to identify the user. Subscription will be previewed for this email</a>
  $ curl -X POST 'https://accesstype.com/api/access/v1/subscription-without-login/preview?key=<key>'-d {
  "emailAddress": 'jane_doe@gmail.com',
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns a subscription object and below additonal details.

attempt_token string
It is the identifier of a subscription attempt. It should be sent back with create subscription api to mark an attempt as success.
external_reference_id string
It is the identifier of payment order created with the Payment gateway. It should be used by the client to make payment.

POST Create subscription without login

Used to create a subscription when user is not logged in.

Arguments

Below arguments need to be passed in addition to subscription create arguments . accesstype_jwt is not required.

emailAddress required
Used to identify the user. Subscription will be created for this email</a>

The request body is required to be same as that required for preview, with additional payment details and attempt_token.

  $ curl -X POST 'https://accesstype.com/api/access/v1/subscription-without-login?key=<key>'-d {
  "emailAddress": "jane_doe@gmail.com",
  "attempt_token": "WnwxA2AVrE3xqcDUqrSb3sNm",
  "subscription": {
      "subscription_plan_id": 2118,
      "notes": "enter your notes",
      "coupon_code": "UAT",
      "payment": {
          "payment_type": "razorpay",
          "amount_cents": 14400,
          "amount_currency": "INR",
          "payment_token": "pay_afddsgsdfg"
      },
      "metadata": {
          "mobile_number": "76398176X8"
      }
    }
}
Returns

This returns subscription object.