NAV Navbar
Request Response
  • Introduction To AccessType
  • AccessType JS
  • Subscriber Identities
  • Subscription Groups
  • Subscriptions
  • Recurring Subscriptions
  • Subscription Gifts
  • Campaigns
  • Pay Per Asset
  • Assets
  • Subscriber Wallets
  • Coupon codes
  • Invoices
  • Subscriber Referral Voucher
  • Webhooks
  • For Quintype Platform Customers
  • For Accepting Donations
  • [DEPRECATED] For Platform Customers
  • AMP Subscriptions
  • FAQ
  • Release Notes
  • Introduction To AccessType

    AccessType is a product for managing subscriptions. It can be used in conjunction with the Quintype Platform

    Terminology

    Payment

    Payment is required to create a subscription for any subscription plan.

    Payment Types

    A payment always has a payment_type associated. It can be one of the below:

    Payment Amount

    It must be same as subscription plan price. If a valid coupon code is applied, the difference of subscription plan price and payment amount must be equal to the discount amount.

    This price validation will be skipped when payment type is android_pay or androidpay_recurring

    AccessType JS

    Readme

    AccessType JS is a javascript library provides out of the box features for publishers to integrate frontend browser applications with AccessType supported payment gateways and AccessType backed APIs.

    Usage

    Load AccessTypeJS on the browser

    https://accesstype.com/frontend/accesstype.js?key=[YOUR_ACCOUNT_KEY]

    AccessType JS will now automatically load the payment provider scripts that are to be used for different payment options activated by your publisher. For e.g. Razorpay, Simpl JS.

    For staging environments where you have configured the payment gateways to use test or sandbox modes, pass an additional query parameter env=sandbox so that the script configures the payment provider scripts accordingly.

    https://accesstype.com/frontend/accesstype.js?key=[YOUR_ACCOUNT_KEY]&env=sandbox

    Set User

    setUser checks the eligibility of the user for different payment providers and their link status. For e.g. does the user have a simpl account for the phone number. After completion it resolves the promise.

    For logged in user

    Once the user has logged in call with user name, emailAddress and phoneNumber. Phone number is be required for providers like Simpl.

    AccessType.setUser({ 'emailAddress': emailAddress, 'mobileNumber':  mobileNumber}).then(() => ... )
    

    For non logged in user

    In case when the user is not logged in, setUser needs to be called with an additional field isLoggedIn: false .

    AccessType.setUser({ 'emailAddress': emailAddress, 'mobileNumber':  mobileNumber, `isLoggedIn`: false}).then(() => ... )
    

    Get Payment Options

    getPaymentOptions() returns the available payment options for the user. For e.g. if user has a simpl account it returns that along.

    AccessType.getPaymentOptions().then((paymentOptions) => ...)
    
    where paymentOptions structure is {
      'simpl': {
        'action': 'link', //anyOf link, pay etc.
        'proceed': fn(args)
      },
      'razorpay': {
        'action': 'pay', //only pay
        'proceed': fn(args)
      },
      'paytm_auto_debit': {
        'action': 'link', //anyOf send_otp, link, pay
        'proceed': fn(args)
      }
    
    }
    

    The keys are the names of the payment providers that can be used of the payment.

    The values are context objects related to that payment provider. For e.g. in the case of Simpl, there is a linking step that a new user will have to complete before they can use it.

    In that case the value for simpl is {'action': 'link', 'proceed': fn() }

    The proceed is a callback function that takes user to next step.

    The pay method accepts an object of the type SubscriptionParams as defined in types.js

    Get Subscription Plans

    Get 'standard' subscription plans

    AccessType.getSubscriptionPlans(): Array<SubscriptionPlan>

    Get Asset Subscription Plans

    Get 'dynamic_asset' subscription plans for given asset

    AccessType.getAssetPlans(asset: PurchaseableAsset): Array<SubscriptionPlan>
    

    Purchase (optional)

    You can at any point use AccessType.purchase(..) to independently make payments and purchase subscriptions.

    JUSPAY integration

    Pre requisites: * Set User and construction of SubscriptionParams refer api.md * Juspay dashboard needs to be set up with a redirect url * In the cases, where user closes the browser after making the payment or Internet goes down for the user. We recoincile the subscriptions by communicating with the payment gateways with the help of webhooks. Go to Webhooks section in Juspay settings, Update the Authentication section with webhook username and webhook password in your Accesstype dashboard under payment gateways, Juspay section. Update the version to 2018-10-25. Update the webhook url to webhook url present in Accesstype dashboard under payment gateways, Juspay section.

    User Flow: - User goes to story page or wherever Juspay has to be triggered. Then user clicks a button for example "Pay with Juspay". - Then a pop up will appear with iFrame of Juspay loaded. - Before the pop-up loads, Accesstype JS will create an event on the page where Pay with Juspay is present and will listen to the pop up. - Once the User completes the payment, The iFrame will redirect to an URL which is specified by you in the Juspay dashboard.

    You need to make sure that the below code block is present in the redirect URL

      (function() {
        var queryParams = window.location.search
        if( queryParams.includes('signature') &&
            queryParams.includes('signature_algorithm') &&
            queryParams.includes('order_id') &&
            queryParams.includes('status')
          ) {
          window.opener.postMessage(queryParams, "*");
        }
      })();
    

    In the page, where AccessType is loaded, when the user clicks Pay with Juspay.

    You can pass optional parameters to juspay payment gateway depending on the payment gateways you want juspay to render.

    const subscriptionParams = {
      "type": "standard",
      "plan": {
        "id": "1",
        "price_cents": "29900",
        "price_currency": "INR",
        "title": "This is the stuff"
      },
      "payment": {
        "payment_type": "juspay",
        "amount_cents": "29900",
        "amount_currency": "INR"
      },
      "metadata": {
        "billing_address_first_name": "Juspay",
        "billing_address_last_name": "Technologies",
        "billing_address_line1": "Girija Building",
        "billing_address_line2": "Ganapathi Temple Road",
        "billing_address_line3": "8th Block, Koramangala",
        "billing_address_city": "Bengaluru",
        "billing_address_state": "Karnataka",
        "billing_address_country": "India",
        "billing_address_postal_code": "560095",
        "billing_address_phone": "9988775566",
        "billing_address_country_code_iso": "IND",
        "shipping_address_first_name": "Juspay",
        "shipping_address_last_name": "Technologies",
        "shipping_address_line1": "Girija Building",
        "shipping_address_line2": "Ganapathi Temple Road",
        "shipping_address_line3": "8th Block, Koramangala",
        "shipping_address_city": "Bengaluru",
        "shipping_address_state": "Karnataka",
        "shipping_address_postal_code": "560095",
        "shipping_address_phone": "9962881912",
        "shipping_address_country_code_iso": "IND",
        "shipping_address_country": "India"
      },
      "juspay": {
        "window_config": {
          // this value can be either "mobile" or "web", when not sent, web is considered to be default
          "type": "mobile"
        }
      }
    }
    AccessType.getPaymentOptions().then((paymentOptions) => paymentOptions.juspay.proceed(subscriptionParams
    )).then((response) => {
      // add your additional functionality like call google analytics
      response.proceed(subscriptionParams).then((subscription) => {// returns a subscription }, (error) => {// handle error});
    })
    
    

    You can customize the juspay iframe popup by passing a few key value pairs object inside window_config under juspay key. The layout of the iframe content can be defined by passing type to the window_config object.

    If the type is not passed to the window_config, by default, the type of iframe content will be web.

    The whole juspay key is optional for the above subscriptionParams object.

    Razorpay Recurring Integration

    For a plan that is set as recurring in Accesstype, subscriptionParams.payment.payment_type needs to be razorpay_recurring.

    Table of Contents

    AccessType

    Available as a global variable on loading accesstype.js

    version

    Returns version of the javascript

    init

    Initializes AccessTypeJS with publisher specific configuration. This is an internal method and will be invoked as part of script initialization in Access Type JS script itself

    Parameters

    setUser

    Set the user context immediately after user logs in.

    Parameters

    Returns Promise<any>

    unsetUser

    Unset user context when user logs off

    Returns void

    getPaymentOptions

    Returns payment options available for the given user for a given transaction amount Payable amount has to be sent as transactionAmountCents, it's generally the price_cents of plan discounted_price_cents from discount_details has to be sent as transactionAmountCents if a coupon code is applied

    Parameters

    Returns Promise<PaymentOptions>

    getAssetPlans

    Returns subscription plans for given param

    Parameters

    Returns Promise<Array<SubscriptionPlan>>

    getSubscriptionPlans

    Returns list of subscription plans across all subscription groups

    Returns Promise<Array<SubscriptionPlan>>

    hasAccess

    Deprecated. Returns if user has access to story id

    Parameters

    Returns Promise<boolean>

    isAssetAccessible

    Returns if the user has access to an asset or not, along with its reason. It makes use thinmint cookie for identifying the user for server side metering.

    Parameters

    Returns Promise<any>

    pingbackAssetAccess

    To be used for updating the meter after asset is accessed. It makes use of thinmint cookie for identifying the user

    Parameters

    Returns Promise<AssetAccess>

    purchase

    Create subscription independently without using the callbacks in getPaymentOptions. Useful for integrating with payment options that AccessTypeJS does not have first class support for

    Parameters

    Returns Promise<any>

    validateCoupon

    Validate coupon with plan

    Parameters

    Returns Promise<CouponValidationResponse>

    validateVoucher

    Validate voucher with plan

    Parameters

    Returns Promise<VoucherValidationRequest>

    getSubscriptions

    Get all subscriptions for a user

    Returns Promise<any>

    updateSubscription

    update metadata for a subscription

    Parameters

    Returns Promise<any>

    getAssets

    Get all assets accessible to a user

    Returns Promise<any>

    getRewards

    Get all rewards for a user

    Returns Promise<any>

    resetWallets

    Reset user wallets For e.g. when user has changed their linked mobile number

    Returns Promise<any>

    downloadInvoice

    Download Invoice for a subscription

    Parameters

    Returns Promise<any>

    isPrivateMode

    Check if browser is in private mode

    getReferralVoucher

    Get Referral code for a user

    Returns Promise<any>

    DurationUnit

    Represents duration unit

    Type: ("months" | "weeks" | "years")

    SubscriptionType

    Represents valid subscription types

    Type: ("standard" | "dynamic_asset")

    AssetType

    Represents supported asset type

    Type: "story"

    PaymentType

    Represents supported payment types

    Type: ("razorpay" | "simpl" | "paytm_auto_debit")

    Environment

    Represents environment

    Type: ("production" | "sandbox")

    User

    Represents a user

    Type: {name: string, emailAddress: string, mobileNumber: string, isLoggedIn: boolean?}

    Properties

    SubscriptionPlan

    Represents a subscription plan

    Type: {id: string, title: string?, description: string?, price_cents: number, price_currency: string, duration_length: number, duration_unit: DurationUnit}

    Properties

    SubscriptionAsset

    Represents an Asset

    Type: {id: string, title: string, slug: string}

    Properties

    PaymentParams

    Represents payment request params

    Type: {payment_type: PaymentType, amount_cents: string, amount_currency: string}

    Properties

    SubscriptionParams

    Represents SubscriptionParams which encapsulates the parameters required to make a subscription

    Type: {type: SubscriptionType, plan: SubscriptionPlan, payment: PaymentParams, assets: Array<SubscriptionAsset>, coupon_code: string?}

    Properties

    SubscriptionMetadata

    Represents metadata fields required to be updated

    Type: {metadata: Object}

    Properties

    InitConfig

    Represents InitConfig which encapsulates initialization params. Used internally only.

    Type: {accesstype_host: string, account_key: string, account_name: string, payment_providers: {}, env: Environment}

    Properties

    PurchaseableAsset

    Represent a purchaseable asset

    Type: {id: string, type: AssetType}

    Properties

    PaymentOption

    Represents a payment option

    For simpl, possible values for action = 'link' | 'pay'

    For razorpay, possible values for action = 'pay'

    When action is 'pay', proceed(params: SubscriptionParams)

    When action is 'link', proceed()

    Type: {action: string, proceed: function (): Promise<any>}

    Properties

    PaymentOptions

    Represents payment options for current user with this publisher

    Type: {}

    Error

    Represents error response

    Type: {code: string, message: string}

    Properties

    CouponValidationRequest

    Represents a coupon validation request

    Type: {subscriptionPlanId: string, couponCode: string}

    Properties

    VoucherValidationRequest

    Represents a voucher validation request

    Type: {subscriptionPlanId: string, voucher: string}

    Properties

    DiscountDetails

    Represents coupon discount

    Type: {code: string, discount_type: string, title: string, value: number, discounted_price_cents: number, price_cents: number, price_currency: string}

    Properties

    CouponValidationResponse

    Represents coupon validation response

    AssetAttributes

    Represents Asset Attributes (e.g. story attributes)

    Type: {accessLevel: AccessLevel, accessLevelValue: number?}

    Properties

    Asset

    Represents an Asset

    Type: {id: string, type: AssetType, attributes: AssetAttributes}

    Properties

    Meter

    Represents paywall meter counts

    Type: {consumed: number, total: number}

    Properties

    AssetAccess

    Represents access of an Asset

    Type: {hasAccess: boolean, accessType: AccessTypeEnum?, meter: Meter?}

    Properties

    Subscriber Identities

    A subscriber is identified by a pair of a provider and an identity (such as [email,dev@quintype.com], or [facebook, fb-id]). A subscriber can have many identities. A provider is an external system. It can be one of [email, quintype, facebook, twitter].

    Most APIs will accept the primary identity via URL parameters, and will also accept query parameters alternate_provider and alternate_identity, which will be used in case the user is not found at the primary identity.

    LIST Subscriber Identities for a user

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriber_identities.json
    
    
    {
      "subscriber_identities": [
        {
          "provider": "email",
          "value": "deepak@gmail.com"
        },
        {
          "provider": "quintype",
          "value": "8759"
        }
      ]
    }
    

    This API will list out all the identities for a user.

    POST Create a Subscriber Identity for a user

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriber_identities.json -d '{
      "subscriber_identity:" {
        "provider": "email",
        "value": "asim2@gmail.com"
      }
    }'
    
    {
    "subscriber_identities":[{
        "provider":"email",
        "value":"asim2@gmail.com"
      },
      {
        "provider":"email",
        "value":"asim@quintype.com"
      }]
    }
    

    This API can be used to add an Identity for an existing subscriber

    Subscription Groups

    LIST all Subscription Groups

    $ curl -H "X-SUBAUTH: <your-auth-token>" https://www.accesstype.com/api/v1/subscription_groups.json
    
    
    {
      "subscription_groups": [{
        "id": 25,
        "account_id": 2,
        "name": "print",
        "description": "Digital + Print",
        "assets": [{
           "id":5,
           "asset_category_id":1,
           "metadata":{},
           "title":"public",
           "type":"site"
         }],
        "subscription_type": "individual",
        "public": true,
        "created_at": "2017-09-04T09:05:06.035Z",
        "updated_at": "2017-09-07T10:21:21.109Z",
        "deleted_at": null,
        "preferred_identity_provider": "email",
        "metadata_fields": [
          "full-name",
          "email",
          "mobile-or-contact-number",
          "street-or-apartment",
          "area-or-locality",
          "city-or-village-and-state",
          "pin-code",
          "country"
        ],
        "subscription_plans": [{
          "id": 23,
          "subscription_group_id": 25,
          "duration_length": 3,
          "price_cents": 34900,
          "price_currency": "INR",
          "additional_assets": [],
          "created_at": "2017-09-04T09:05:06.047Z",
          "updated_at": "2017-09-04T09:05:06.047Z",
          "duration_unit": "months",
          "description": null,
          "title": "print-3",
          "max_trial_period_length": null,
          "max_trial_period_unit": null,
          "recurring": false,
          "metadata": {}
        }]
      }]
    }
    

    This API will list out all public subscription groups

    GET a Subscription Group

    $ curl -H "X-SUBAUTH: <your-auth-token>" https://www.accesstype.com/api/v1/subscription_groups/<group-id>.json
    
    
    {
      "subscription_group": {
        "id": 25,
        "account_id": 2,
        "name": "print",
        "description": "Digital + Print",
        "assets": [{
           "id":5,
           "asset_category_id":1,
           "metadata":{},
           "title":"public",
           "type":"site"
         }],
        "subscription_type": "individual",
        "public": true,
        "created_at": "2017-09-04T09:05:06.035Z",
        "updated_at": "2017-09-07T10:21:21.109Z",
        "deleted_at": null,
        "preferred_identity_provider": "email",
        "metadata_fields": [
          "full-name",
          "email",
          "mobile-or-contact-number",
          "street-or-apartment",
          "area-or-locality",
          "city-or-village-and-state",
          "pin-code",
          "country"
        ],
        "subscription_plans": [{
          "id": 23,
          "subscription_group_id": 25,
          "duration_length": 3,
          "price_cents": 34900,
          "price_currency": "INR",
          "additional_assets": [],
          "created_at": "2017-09-04T09:05:06.047Z",
          "updated_at": "2017-09-04T09:05:06.047Z",
          "duration_unit": "months",
          "description": null,
          "title": "print-3",
          "max_trial_period_length": null,
          "max_trial_period_unit": null,
          "recurring": false,
          "metadata": {}
        }]
      }
    }
    

    This will fetch a subscription, either a public or private one

    Subscriptions

    Subscription plan and Payment information is required to create a subscription for a user. payment-type can be one of razorpay, razorpay_recurring, androidpay, androidpay_recurring. It can also be set to manual to create subscriptions not involving payments.

    LIST Subscriptions for a user

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions.json
    
    
    
    {
      "subscriptions": [
        {
          "subscriber": {
            "id": 1087,
            "name": null,
            "created_at": "2019-08-14T09:43:57.557Z",
            "updated_at": "2019-08-14T09:43:57.557Z",
            "metadata": null,
            "cumulative_end_timestamps": {
                "standard_subscriptions_cumulative_end_timestamp": "2019-09-14T09:43:57.801Z",
                "campaign_subscriptions_cumulative_end_timestamp": "2020-04-14T09:45:02.183Z"
            },
            "subscriber_identities": [
                {
                    "provider": "email",
                    "value": "foo@example.com"
                },
                {
                    "provider": "quintype",
                    "value": "123"
                }
            ]
          },
          "invoices": [
            {
              "amount_after_discount_before_tax": "122.03",
              "amount_currency": "INR",
              "id": 990,
              "invoice_taxes": {
                "SGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                },
                "CGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                }
              },
              "amount_cents": 14400,
              "base_price": "152.54",
              "sequenced_invoice_number": "BQ/1819/SUB/167",
              "discount_details": {
                "code": "UAT",
                "discount_percentage": 20,
                "discount_amount": "30.51"
              },
              "created_at": "2018-12-12T10:25:48.590Z"
            }
          ],
          "id": 713,
          "subscriber_id": 453,
          "subscription_plan_id": 16,
          "created_at": "2017-10-30T10:55:42.201Z",
          "updated_at": "2017-10-30T10:55:42.201Z",
          "assets": [
            {
              "metadata": {},
              "title": "public",
              "type": "site"
            }
          ],
          "start_timestamp": "2017-10-30T10:55:42.176Z",
          "end_timestamp": "2017-11-13T10:55:42.176Z",
          "deleted_at": null,
          "payment_id": 668,
          "metadata": {
            "Name": "Sample User",
            "Address": "Sample add",
            "Phone Number": "1111111111"
          },
          "external_id": null,
          "trial_period_length": null,
          "trial_period_unit": null,
          "coupon_code": null,
          "subscription_group_id": 21,
          "preferred_identity": {
            "provider": "email",
            "value": "sample@gmail.com"
          },
          "group_name": "Sub Group 1",
          "plan_name": "Sub Plan 1",
          "duration_length": 2,
          "duration_unit": "weeks",
          "subscription_type": "individual",
          "active": true,
          "payment_amount": "0.00",
          "payment_type": "manual",
          "renewable": true,
          "coupon_code_id": 6,
          "discount_detail": {
            "code": "TEST20",
            "discount_type": "percent",
            "title": "Test coupon gives 20 percent off",
            "value": 20.0,
            "discounted_price_cents": 8000.0,
            "price_cents": 10000,
            "price_currency": "USD"
          },
        "expires_in_days": 30
        }
      ]
    }
    

    This API will list out all the subscriptions for a user. In order to get only active subscriptions, param active_only=true can be used.

    POST Preview a Subscription

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/preview.json -d '{
        "subscription": {
            "notes": "enter your notes",
            "alternate_provider": "email",
            "alternate_identity": "hey@quintype.com",
            "subscription_type": "standard",
            "subscription_plan_id": 2118,
            "coupon_code": "UAT",
            "payment": {
                "payment_type": "razorpay",
                "amount_cents": 14400,
                "amount_currency": "INR"
            },
            "metadata": {
                "mobile_number": "7639817688"
            }
        },
        "fingerprint": ""
    }'
    
    {
        "subscription": {
            "subscriber": {
                "id": 1087,
                "name": 'foo',
                "created_at": "2019-08-14T09:43:57.557Z",
                "updated_at": "2019-08-14T09:43:57.557Z",
                "metadata": null,
                "cumulative_end_timestamps": {
                    "standard_subscriptions_cumulative_end_timestamp": null,
                    "campaign_subscriptions_cumulative_end_timestamp": null
                },
                "subscriber_identities": [
                    {
                        "provider": "email",
                        "value": "foo@example.com"
                    },
                    {
                        "provider": "quintype",
                        "value": "123"
                    }
                ]
            },
            "notes": "enter your notes",
            "invoices": [],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": null,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "preview",
            "cancelled": false,
            "payment_token": null,
            "updated_at": null,
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": null,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "email",
                "value": "vamsi@quintype.com"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": null,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": null,
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        },
        "attempt_token": "WnwxA2AVrE3xqcDUqrSb3sNm",
        "external_reference_id": null
    }
    

    It returns a preview for a Subscription, without creating a new subscription. For a successful subscription, it also return an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back with create subscription api to mark an attempt as success.

    This API must be used before accepting payment from a user.

    One can pass the value for payment.payment_type as razorpay_recurring when making the preview API call to get external_reference_id and attempt_token in response.

    POST Create a Subscription

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions.json -d '{
        "subscription": {
            "notes": "enter your notes",
            "subscription_type": "standard",
            "subscription_plan_id": 2118,
            "coupon_code": "UAT",
            "payment": {
                "payment_type": "razorpay",
                "amount_cents": 14400,
                "amount_currency": "INR",
                "payment_token": "pay_BWpQWQcLLK3L37"
            },
            "metadata": {
                "mobile_number": "7639817688"
            }
        },
        "alternate_provider": "email",
        "alternate_identity": "hey@quintype.com",
        "attempt_token": "WnwxA2AVrE3xqcDUqrSb3sNm"
    }'
    
    {
        "subscription": {
            "subscriber": {
                "id": 1087,
                "name": 'foo',
                "created_at": "2019-08-14T09:43:57.557Z",
                "updated_at": "2019-08-14T09:43:57.557Z",
                "metadata": null,
                "cumulative_end_timestamps": {
                    "standard_subscriptions_cumulative_end_timestamp": "2019-09-14T09:43:57.801Z",
                    "campaign_subscriptions_cumulative_end_timestamp": null
                },
                "subscriber_identities": [
                    {
                        "provider": "email",
                        "value": "foo@example.com"
                    },
                    {
                        "provider": "quintype",
                        "value": "123"
                    }
                ]
            },
            "expires_in_days": 30,
            "notes": "enter your notes",
            "invoices": [
                {
                    "amount_after_discount_before_tax": "122.03",
                    "amount_currency": "INR",
                    "id": 990,
                    "invoice_taxes": {
                        "SGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        },
                        "CGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        }
                    },
                    "amount_cents": 14400,
                    "base_price": "152.54",
                    "sequenced_invoice_number": "BQ/1819/SUB/167",
                    "discount_details": {
                        "code": "UAT",
                        "discount_percentage": 20,
                        "discount_amount": "30.51"
                    },
                    "created_at": "2018-12-12T10:25:48.590Z"
                }
            ],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": 96595,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "razorpay",
            "cancelled": false,
            "payment_token": "pay_BWpQWQcLLK3L37",
            "updated_at": "2018-12-12T10:25:48.494Z",
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": 32405,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "quintype",
                "value": "251933"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": 32379,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": "2018-12-12T10:25:48.494Z",
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        }
    }
    

    This API can be used to create a subscription.

    Here attempt_token is the token received from preview.

    Use campaign_id optional field to create subscription for specific campaign.

    It returns a Subscription Object in response

    PATCH update attributes

    curl -H "X-SUBAUTH: <auth-token>" -X PATCH -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/<id>.json -d '{
      "subscription": {
        "metadata":  {
            "full-name": "hello-world",
            "email": "hello@quintype.com"
        }
      }
    }'
    

    This API can be used to update the attributes for a subscription of a subscriber

    PATCH bulk update attributes

    curl -H "X-SUBAUTH: <auth-token>" -X PATCH -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions.json -d '{
      "metadata":  {
        "full-name": "hello-world",
        "email": "hello@quintype.com"
      }
    }'
    

    This API can be used to update the attributes of all active subscriptions of a subscriber

    DELETE a subscription

    curl -H "X-SUBAUTH: <auth-token>" -X "DELETE" -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/<subscription-id>.json
    

    This API can be used to delete a subscription(THIS API WILL BE DEPRECATED SOON IN FAVOUR OF CANCEL Subscription API)

    CANCEL a subscription

    curl -H "X-SUBAUTH: <auth-token>" -X "PUT" -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/<subscription-id>/cancel.json
    

    This API can be used to cancel a subscription

    POST renew a subscription

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/<subscription_id>/renewals.json -d '{
      "subscription": {
        "coupon_code": "",
        "payment": {
            "payment_type": "razorpay",
            "payment_token": "pay_test_8tNiqdiajurOkj",
            "amount_cents": "99900",
            "amount_currency": "INR"
        }
      },
      "alternate_provider": "email",
      "alternate_identity": "hey@quintype.com"
    }'
    

    This API can be used to renew any renewable subscription. Subscriptions to recurring-plans are not renewable. The new subscription starts immediately or at the end of active subscription.

    One can use the optional metadata field to set it different from that of the existing subsription. If not passed, it is set to be same as existing subscription.

    It returns a Subscription Object in response

    Recurring Subscriptions

    In order to register a recurring subscription with some providers (such as razorpay), it is mandatory to register a subscription upstream.

    POST register a recurring subscription

    curl -H "X-SUBAUTH: <auth-token>" -X POST -H "Content-Type: application/json" https://www.accesstype.com/api/v1/subscription_plans/<subscription-plan-id>/external_subscription_token.json -d '{
      "type": "razorpay",
      "attempt_token": "fo4bMWjP6N5vtVySNtiAUNBQ"
    }'
    
    {
      "subscription": {
        "id": "sub_8tQNd3qURQJiK5"
      }
    }
    

    attempt_token is optional param and must be sent if the external subscription is not to start immediately.

    NOTE:- This API will soon be deprecated, as the same can now be achieved by preview API.

    Subscription Gifts

    POST Create a Subscription for gifting

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscription_gifts.json -d '{
      "name": "Adam",
      "recipient_subscriber": {
        "recipient_identity_provider": "email",
        "recipient_identity": "somefriend@foo.com"
      },
      "subscription": {
        "subscription_plan_id": "11",
        "coupon_code": "",
        "payment": {
            "payment_type": "razorpay",
            "payment_token": "pay_test_8tNiqdiajurOkj",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "somefriend",
            "email": "somefriend@foo.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      },
      "alternate_provider": "email",
      "alternate_identity": "hey@quintype.com"
    }'
    

    This API can be used to create a subscription and gift it to a recipient_subscriber. recipient_subscriber details are required. It returns a Subscription Object in response

    LIST Subscriptions gifted by a user

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscription_gifts.json
    
    
    {
     "subscriptions":[
      {
         "id":713,
         "subscriber_id":453,
         "subscription_plan_id":16,
         "created_at":"2017-10-30T10:55:42.201Z",
         "updated_at":"2017-10-30T10:55:42.201Z",
         "assets":[
    
         ],
         "start_timestamp":"2017-10-30T10:55:42.176Z",
         "end_timestamp":"2017-11-13T10:55:42.176Z",
         "deleted_at":null,
         "payment_id":668,
         "metadata":{
            "Name":"Sample User",
            "Address":"Sample add",
            "Phone Number":"1111111111"
         },
         "external_id":null,
         "trial_period_length":null,
         "trial_period_unit":null,
         "coupon_code":null,
         "subscription_group_id":21,
         "preferred_identity":{
            "provider":"email",
            "value":"sample@gmail.com"
         },
         "group_name":"Sub Group 1",
         "plan_name":"Sub Plan 1",
         "duration_length":2,
         "duration_unit":"weeks",
         "subscription_type":"individual",
         "active":true,
         "payment_amount":"0.00",
         "payment_type":"manual",
         "renewable": true
        }
      ]
    }
    

    Campaigns

    LIST all Campaigns

    $ curl -H "X-SUBAUTH: <your-auth-token>" https://www.accesstype.com/api/v1/campaigns.json
    
    {
      "campaigns": [{
        "id": 25,
        "account_id": 2,
        "target_amount_cents": 10000000,
        "target_amount_currency": "INR",
        "subscription_group_id": 1,
        "name": "Life On The Border And The Unheared stories",
        "description": "Soldiers at the border have become a staple source of news for mainstream media. But how much do we know about life at the border for those who call it home? In one of the villages along the LoC, a crippling disease is preventing people from getting Aadhaar cards.",
        "created_at": "2018-04-09T05:28:22.746Z",
        "updated_at": "2018-04-09T05:28:22.746Z",
        "deleted_at": null,
        "goal_reached": false,
        "enabled": true,
        "metadata": [],
        "collected_amount": "0.00",
        "collected_amount_cents": 0,
        "collected_amount_currency": "INR",
        "collected_amount_percentage": 0,
        "target_amount": "100000.00",
        "subscription_plans": [{
          "id": 10,
          "subscription_group_id": 1,
          "duration_length": 3,
          "price_cents": 34900,
          "price_currency": "INR",
          "additional_assets": [],
          "created_at": "2017-09-04T09:05:06.047Z",
          "updated_at": "2017-09-04T09:05:06.047Z",
          "duration_unit": "months",
          "description": null,
          "title": "print-3",
          "max_trial_period_length": null,
          "max_trial_period_unit": null,
          "recurring": false,
          "metadata": {},
          "assets": [],
          "display_assets": []
        }]
      }]
    }
    

    This API will list out all campaigns that are set up for the account.

    GET a Campaign

    $ curl -H "X-SUBAUTH: <your-auth-token>" https://www.accesstype.com/api/v1/campaigns/<campaign-id>.json
    
    {
      "campaign": {
        "id": 1,
        "target_amount_cents": 10000000,
        "target_amount_currency": "INR",
        "subscription_group_id": 1,
        "name": "Life On The Border And The Unheared stories",
        "description": "Soldiers at the border have become a staple source of news for mainstream media. But how much do we know about life at the border for those who call it home? In one of the villages along the LoC, a crippling disease is preventing people from getting Aadhaar cards.",
        "created_at": "2018-04-09T05:28:22.746Z",
        "updated_at": "2018-04-09T05:28:22.746Z",
        "deleted_at": null,
        "goal_reached": false,
        "enabled": true,
        "metadata": [],
        "collected_amount": "0.00",
        "collected_amount_cents": 0,
        "collected_amount_currency": "INR",
        "collected_amount_percentage": 0,
        "target_amount": "100000.00",
        "subscription_plans": [{
          "id": 23,
          "subscription_group_id": 25,
          "duration_length": 3,
          "price_cents": 34900,
          "price_currency": "INR",
          "additional_assets": [],
          "created_at": "2017-09-04T09:05:06.047Z",
          "updated_at": "2017-09-04T09:05:06.047Z",
          "duration_unit": "months",
          "description": null,
          "title": "print-3",
          "max_trial_period_length": null,
          "max_trial_period_unit": null,
          "recurring": false,
          "metadata": {}
          "assets": [],
          "display_assets": []
        }]
      }
    }
    
    

    This will fetch details of a specific campaign.

    POST Preview a Patron Subscription

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/preview.json -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "campaign_id": "1",
        "coupon_code": "NEWYEAR",
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "payment": {
            "payment_type": "razorpay"
        },
        "start_timestamp": "2018-07-24 00:00:00"
      },
      "alternate_provider": "email",
      "alternate_identity": "hey@quintype.com",
      "name": "Ben"
    }'
    

    It returns a preview for a Patron of a Campaign, without creating a Patron for a Campaign.

    The campaign_id field must be sent in the request for the request to be identified as a Patron Subscription Attempt.

    For a successful preview attempt, it returns an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back with create subscription api to mark an attempt as success.

    This API must be used before accepting payment from a potential patron.

    One can pass the value for payment.payment_type as razorpay_recurring when making the preview API call to get external_reference_id and attempt_token in response.

    POST Create a Patron Subscription

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions.json -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "campaign_id": "1",
        "coupon_code": "NEWYEAR",
        "payment": {
            "payment_type": "razorpay",
            "payment_token": "pay_test_8tNiqdiajurOkj",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      },
      "alternate_provider": "email",
      "alternate_identity": "hey@quintype.com",
      "attempt_token": "fo4bMWjP6N5vtVySNtiAUNBQ",
      "name": "Ben"
    }'
    

    This API can be used to create a Patron Subscription.

    The campaign_id field must be sent in the request for the request to be identified as a Patron Subscription Creation.

    Here attempt_token is the token received from preview.

    It returns a Subscription Object in response.

    Pay Per Asset

    List Prices of Assets

    curl -H "X-SUBAUTH: <auth-token>" -X GET 'http://www.accesstype.com/api/v1/asset/<asset-type>/pricing_plans.json?id=123456&collection_id[]=123&collection_id[]=456>'
    
    {
        "pricing_plans": [
            {
                "id": 1071,
                "price_cents": 1400,
                "price_currency": "INR",
                "duration_length": 1,
                "duration_unit": "lifetime"
            },
            {
                "id": 1959,
                "price_cents": 1000,
                "price_currency": "INR",
                "duration_length": 1,
                "duration_unit": "months"
            }
        ]
    }
    

    This API returns the prices of a story or a collection when sold individually.

    Parameter Type Occurrence Description
    /<asset-type>/ string 1 The type of asset that is being purchased. Valid Values for Quintype CMS story,collection
    id string 1 The identifier of the story or collection that is being purchased.
    collection_id[] string 0 or many The identifier of the collection that the story belongs to. Used when the value of /<asset-type>/ is story.

    Create Asset Purchase API

    curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST http://www.accesstype.com/api/v1/subscribers/email/myid@example.com/subscriptions.json -d '{
      "subscription": {
        "subscription_type": "dynamic_asset",
        "subscription_plan_id": <pricing-plan-id>,
        "payment": {
          "payment_type": "simpl"
        },
        "metadata":  {
          "full-name": "hello",
          "email": "hello@quintype.com"
        },
        "dynamic_assets": [{
            "id": "some_asset_id"
         }]
      },
      "alternate_provider": "email",
      "alternate_identity": "hey@quintype.com",
      "attempt_token": "fo4bMWjP6N5vtVySNtiAUNBQ",
      "name": "Ben"
    }
    

    Assets

    LIST All Assets accessible to a user

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/assets.json
    
    
    
    {
       "assets":[
         {
           "metadata":{},
           "title":"public",
           "type":"site"
         }
       ]
    }
    
    

    Subscriber Wallets

    POST subscriber wallet token

    $ curl -H "X-SUBAUTH: <auth-token>" -H "Content-Type: application/json" -X POST https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriber_wallets.json -d '{
         "subscriber_wallet": {
            "provider": "simpl",
            "metadata": {
                "token": "8ashfsdfvyhurn8g9w85gjf"
            }
        }
     }'
    
    {
      "subscriber_wallet": {
        "provider": "simpl",
        "metadata": {
          "token": "thenashfsdfvyurn8g9w85gjf"
          }
        }
      }
    

    This request allows to POST a user's wallet token from any wallet provider. Examples of Providers: Simpl, PayTm

    Allowed values for subscriber_wallet.provider are simpl,paytm.

    Parameter Type Mandatory Description
    subscriber_wallet.provider string Yes Valid Values simpl,paytm
    subscriber_wallet.metadata object Yes Can have multiple key value pairs. Can be used to store tokens provided by wallet provider. E.g., "token": "8ashfsdfvyhurn8g9w85gjf"

    The request body is returned back in the response.

    LIST wallets of subscriber

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriber_wallets.json
    
    
    {
      "subscriber_wallets": [{
        "provider": "paytm_auto_debit",
        "metadata": {
          "exprires_at": "1517922233955"
          }
        },
        {
        "provider": "simpl",
        "metadata": {}
        }]
      }
    

    This API call returns all the wallets of a subscriber.

    DELETE wallets of subscriber

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriber_wallets.json -X DELETE
    
    

    This API deletes all the wallets of a subscriber.

    Coupon codes

    GET discount details for a subscription plan

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscription_plans/<subscription-plan-id>/coupon_codes/<code>/validate.json
    
    {
      "discount_details": {
        "code": "TEST100",
        "discount_type": "amount",
        "title": "test-100",
        "value": 1000,
        "discounted_price_cents": 28900,
        "price_cents": 29900,
        "price_currency": "INR"
      },
      "message": "Applied successfully"
    }
    

    It returns discount details for a active coupon code.

    Invoices

    GET invoice details for a subscription

    $ curl -H "X-SUBAUTH: <auth-token>"
    https://accesstype.com/api/v1/subscribers/<provider>/<identity>/subscriptions/<subscription_id>/invoices/<invoice_id>/download.json
    
    It returns the invoice.pdf file in pdf format
    

    This API is used to download the invoice in the pdf format.

    Invoice Template Variables

    The below format considers the price inclusive of taxes.

    Name Description
    user_name Name of the user in the accesstype who purchased the subscription
    invoice_number The sequence of invoice number for that account. Example: publisher_name/1, publiser_name/2
    user_email Email of the user in the accesstype who purchased the subscription
    date Date of purchase of subscription. Example: 11 Dec 2018
    payment_method Payment gateway used by the purchaser. Example: razorpay, simpl, paytm
    recurring true if it's a recurring subscription, false if it's a one time payment
    base_price Basic price is the amount receivable by the publisher from the user for the purchase of subscription minus any tax on the product.For example if 110 is the price paid by the user and 10 % if the tax specified by the admin. The base price is calculated by the following formula (110/(1+10/100)), which equals 100
    subscription_group_title The subscription group name, the subscription plan belongs to
    subscription_plan_title The subscription plan name, for which the user purchases a subscription
    subscription_plan_price The price of the subscription plan, specified by the admin without any discount applied
    amount_paid The amount received from the user. If the user applies a discount, discount is applied on the plan amount.
    discount_details It's a hash with following fields code - which represents the discount code applied by the user discount_percentage - which represents the percentage of discount applied discount_amount - which represents the amount of the discount Example: {"code" => "UAT","discount_percentage" => 20,"discount_amount" => "77.97"}
    taxes It's a hash with tax objects. If multiple taxes are specified by the admin, multiple tax objects will be present in this object {"SGST" => {"percentage" => "9.0","amount" => "28.07","currency" => "INR"}, "CGST" => {"percentage" => "9.0","amount" => "28.07","currency" => "INR"} }
    subscription_end_date Represents the end date of the subscription
    dynamic_assets This is applicable for pay per asset type of subscriptions. Suppose if user purchases a storytitle, slug will be available in this field Example: [{id: "some_asset_id", title: "Some title", slug: "/some-slug"}]
    amount_after_discount_before_tax This amount is arrived at, when discount is applied on the base price and does not include the tax amounts.
    round_off The amount that was rounded off in calculating the amount paid by the subscriber from the calculated base price, price after discount and taxes. Unit: Rupee for INR and dollar for USD.
    benefit_product This is the title of the befefit product that is added to referree, because he/she used a coupon code which has discount type unit
    notes If there are any notes made during the subscription creation

    Subscriber Referral Voucher

    Currently this feature is available only for accounts that use Voucherify

    Every subscriber has a referral voucher code that he can share with others.

    GET Referral voucher for a user

    $ curl -H "X-SUBAUTH: <auth-token>" https://www.accesstype.com/api/v1/subscribers/<provider>/<identity>/referral_voucher.json
    
    
    {
        "referral_voucher": {
            "provider": "voucherify",
            "code": "MY_REFERRAL",
            "subscriber_id": 998
        }
    }
    

    This API will return the referral voucher code for a user.

    It will accept the primary identity via URL parameters, and will also accept query parameters alternate_provider, alternate_identity and name.

    Webhooks

    Accesstype has the ability to inform third party system by webhook calls that it makes to any third party systems.

    How to Setup Accesstype webhooks

    1. Login to Accesstype and go to Settings > Outgoing webhooks > Add Webhook
    2. Enter the URL that you would like Accesstype to make a POST call to.
    3. Optionally enter a Secret in case you wish to verify and segregate the calls made from Accesstype. Click here for more info on how to verify Accesstype webhooks.
    4. Check the Active checkbox. This is useful to activate the webhook when Accesstype automatically disables in case of failures.
    5. Select one or more events for which for which you would want the webhook call to be made, and press save.

    How Accesstype Outgoing Webhooks work

    {
      "event": "subscription.created",
      "event_timestamp": "2019-06-16T14:04:39.836Z",
      "data": {
        "subscriber": {
          "id": 1087,
          "name": null,
          "created_at": "2019-08-14T09:43:57.557Z",
          "updated_at": "2019-08-14T09:43:57.557Z",
          "metadata": null,
          "cumulative_end_timestamps": {
              "standard_subscriptions_cumulative_end_timestamp": "2019-09-14T09:43:57.801Z",
              "campaign_subscriptions_cumulative_end_timestamp": "2020-04-14T09:45:02.183Z"
          },
          "subscriber_identities": [
              {
                  "provider": "email",
                  "value": "foo@example.com"
              },
              {
                  "provider": "quintype",
                  "value": "123"
              }
          ]
        },
        "expires_in_days": 30,
        "id": 213,
        "subscriber_id": 234,
        "subscription_plan_id": 26,
        "created_at": "2019-06-16T14:04:39.836Z",
        "updated_at": "2019-06-16T14:04:39.836Z",
        "assets": [
          {
            "title": "Monthly magazines",
            "metadata": {},
            "type": "static"
          },
          {
            "title": "All exclusive reportage content",
            "metadata": {
              "access_level": 400
            },
            "type": "story"
          },
          {
            "title": "All paid stories",
            "metadata": {
              "access_level": 300
            },
            "type": "story"
          }
        ],
        "start_timestamp": "2019-06-16T14:04:39.836Z",
        "end_timestamp": "2049-06-16T14:04:39.836Z",
        "deleted_at": null,
        "payment_id": 213,
        "metadata": {
          "full-name": "Damon Fritsch",
          "email": "blakemcglynn@west.io",
          "mobile-or-contact-number": "504.901.7100"
        },
        "external_id": null,
        "trial_period_length": null,
        "trial_period_unit": null,
        "campaign_id": null,
        "plan_amount_cents": 999900,
        "plan_amount_currency": "INR",
        "duration_unit": "years",
        "duration_length": 30,
        "plan_name": "Gold-lifetime-30-years",
        "plan_description": null,
        "group_name": "Gold",
        "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
        "subscription_type": "standard",
        "plan_occurrence": "One Time",
        "subscription_attempt_id": 224,
        "renewal_reminder_sent_date": null,
        "dynamic_assets": [
          {
            "id": "df46ab654bfaa0067f928dd3247710e8",
            "title": "A Summer Bird-Cage",
            "slug": "voluptatem_quaerat"
          }
        ],
        "coupon_discount_id": null,
        "subscription_group_id": 7,
        "preferred_identity": {
          "provider": "email",
          "value": "blakemcglynn@west.io"
        },
        "active": true,
        "payment_amount": "0.00",
        "payment_amount_cents": 0,
        "payment_amount_currency": "USD",
        "payment_type": "manual",
        "payment_token": null,
        "renewable": true,
        "status": "active",
        "expired": false,
        "coupon_code": null,
        "campaign_name": null,
        "campaign_subscription": false,
        "recurring": false,
        "cancelled_at": null,
        "next_payment_due_date": null,
        "cancelled": false,
        "in_grace_period": false,
        "invoices": [
          {
            "id": 210,
            "sequenced_invoice_number": "",
            "base_price": "9999",
            "amount_cents": 0,
            "amount_currency": "USD",
            "created_at": "2019-07-16T14:04:49.847Z",
            "amount_after_discount_before_tax": "9999",
            "discount_details": {},
            "invoice_taxes": {},
            "round_off": "9999",
            "external_payment_id": null,
            "downloadable": false
          }
        ],
        "subscriber_name": "Damon Fritsch",
        "discount_detail": {},
        "referrer": null
      }
    }
    

    Description of events

    Event name Applicability Description
    subscription.expiry One-time and Recurring Subscriptions Triggered when a one-time-subscription has expired or a recurring subscription which was cancelled, has come to an end.
    subscription.cancellation One-time and Recurring Subscriptions Triggered when a one-time or a recurring subscription is cancelled.
    subscription.renewal Recurring Subscriptions Triggered when a recurring subscription is successfully renewed for the subsequent cycle.
    subscription.creation One-time and Recurring Subscriptions Triggered when a new subscription is created.
    subscription.entered_grace_period Recurring Subscriptions Triggered when the payment is pending for a recurring subscription, and is not yet renewed. Note: When a payment is due for a recurring subscription, Accesstype waits for the payment for a grace period of 5 days before it marks the subscription as expired. During this grace period, the subscriber continues to gain access to the content.
    subscription.activated One-time and Recurring subscriptions Triggered when a subscription which was created in the Pending state, becomes Active.
    subscription.expiry_reminder One-time Subscriptions Triggered as per the Number of Days Before Subscription Expiry in the webhooks dashboard
    subscriber.creation -NA- Triggered when a new Subscriber is created in Accesstype.

    Verify Webhooks sent by Accesstype

    signature = request.headers['X-AT-Signature']
    digest = OpenSSL::Digest.new('sha256')
    secret = "foobar" # the secret that you have set in dashboard of Accesstype
    message = request.body.read
    digest = OpenSSL::HMAC.hexdigest(digest, secret, message)
    ActiveSupport::SecurityUtils.secure_compare(digest, signature)
    

    This section is useful when the Outgoing Webhooks feature is enabled in Accesstype dashboard under Accesstype > Settings > Outgoing Webhooks and if the field Secret has a value setup in the webhook.

    Each webhook request will include a base64-encoded X-AT-Signature in the header, which is generated using the Secret that is setup in the Accesstype dashboard.

    To verify that the request came from Accesstype, the HMAC digest must be computed according to an algorithm and compared with the value in the X-AT-Signature header. If they match, then you can be sure that the webhook was sent from Accesstype.

    An example of the algorithm for signature verification is seen here in Rails.

    For Quintype Platform Customers

    The customers of Quintype platform that have login implemented can use below APIs for subscriptions in Accesstype.

    All the below APIs are safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    POST Preview a subscription for logged in user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "content-type: application/json" https://sketches.quintype.com/api/access/v1/members/me/subscriptions/preview -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "coupon_code": "NEWYEAR",
        "payment": {
            "payment_type": "razorpay",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      }
    }
    '
    
      {
        "subscription": {
            "id": null,
            "subscriber_id": 8302,
            "subscription_plan_id": 11,
            "created_at": null,
            "updated_at": null,
            "assets": [],
            "start_timestamp": "2218-09-29T19:54:02.833Z",
            "end_timestamp": "2318-09-29T19:54:02.833Z",
            "deleted_at": null,
            "payment_id": null,
            "metadata": {
              "full-name": "hello",
              "email": "hello@quintype.com"
            },
            "external_id": null,
            "trial_period_length": null,
            "trial_period_unit": null,
            "code": null,
            "discount_detail": {},
            "coupon_code_id": null,
            "campaign_id": null,
            "plan_amount_cents": 50000,
            "plan_amount_currency": "INR",
            "duration_unit": "lifetime",
            "duration_length": 1,
            "plan_name": "life time ",
            "plan_description": "life time ",
            "group_name": "prod test 30 aug",
            "group_description": "prod test 30 aug",
            "subscription_type": "standard",
            "plan_occurrence": "One Time",
            "subscription_attempt_id": null,
            "renewal_reminder_sent_date": null,
            "dynamic_assets": {},
            "subscription_group_id": 2313,
            "preferred_identity": {
                "provider": "email",
                "value": "biswajit+29@quintype.com"
            },
            "active": false,
            "payment_amount": "0.00",
            "payment_amount_cents": 0,
            "payment_amount_currency": "USD",
            "payment_type": "manual",
            "payment_token": null,
            "renewable": false,
            "status": "pending",
            "expired": false,
            "coupon_code": "NEWYEAR,
            "campaign_name": null,
            "campaign_subscription": false,
            "recurring": false,
            "cancelled_at": null,
            "next_payment_due_date": null,
            "cancelled": false,
            "in_grace_period": false
        },
        "attempt_token": "SSLvhLBEWiMxcEiMKgHxATpJ",
        "external_reference_id": null
    }
    

    It returns a preview for a Subscription, without creating a new subscription. For a successful subscription, it also return an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back with create-subscription api.

    We highly recommend use of this API before accepting payment from a user.

    POST Create Subscription for logged in user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X POST http://sketches.quintype.com/api/access/v1/members/me/subscriptions -d '{
      "subscription": {
        "subscription_plan_id": "2118",
        "coupon_code": "UAT",
        "payment": {
            "payment_type": "razorpay",
            "payment_token": "pay_BWpQWQcLLK3L37",
            "amount_cents": "14400",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2018-09-21 00:00:00"
      },
      "attempt_token": "fo4bMWjP6N5vtVySNtiAUNBQ"
    }'
    
    {
        "subscription": {
            "invoices": [
                {
                    "amount_after_discount_before_tax": "122.03",
                    "amount_currency": "INR",
                    "id": 990,
                    "invoice_taxes": {
                        "SGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        },
                        "CGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        }
                    },
                    "amount_cents": 14400,
                    "base_price": "152.54",
                    "sequenced_invoice_number": "BQ/1819/SUB/167",
                    "discount_details": {
                        "code": "UAT",
                        "discount_percentage": 20,
                        "discount_amount": "30.51"
                    },
                    "created_at": "2018-12-12T10:25:48.590Z"
                }
            ],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": 96595,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "razorpay",
            "cancelled": false,
            "payment_token": "pay_BWpQWQcLLK3L37",
            "updated_at": "2018-12-12T10:25:48.494Z",
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": 32405,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "quintype",
                "value": "251933"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": 32379,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": "2018-12-12T10:25:48.494Z",
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        }
    }
    

    This API can be used to create a subscription.

    Here attempt_token is the token received from preview.

    LIST All subscriptions of a user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/access/v1/members/me/subscriptions
    
    
    {
      "subscriptions": [
        {
          "invoices": [
            {
              "amount_after_discount_before_tax": "122.03",
              "amount_currency": "INR",
              "id": 990,
              "invoice_taxes": {
                "SGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                },
                "CGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                }
              },
              "amount_cents": 14400,
              "base_price": "152.54",
              "sequenced_invoice_number": "BQ/1819/SUB/167",
              "discount_details": {
                "code": "UAT",
                "discount_percentage": 20,
                "discount_amount": "30.51"
              },
              "created_at": "2018-12-12T10:25:48.590Z"
            }
          ],
          "id": 713,
          "subscriber_id": 453,
          "subscription_plan_id": 16,
          "created_at": "2017-10-30T10:55:42.201Z",
          "updated_at": "2017-10-30T10:55:42.201Z",
          "assets": [
            {
              "metadata": {},
              "title": "public",
              "type": "site"
            }
          ],
          "start_timestamp": "2017-10-30T10:55:42.176Z",
          "end_timestamp": "2017-11-13T10:55:42.176Z",
          "deleted_at": null,
          "payment_id": 668,
          "metadata": {
            "Name": "Sample User",
            "Address": "Sample add",
            "Phone Number": "1111111111"
          },
          "external_id": null,
          "trial_period_length": null,
          "trial_period_unit": null,
          "coupon_code": null,
          "subscription_group_id": 21,
          "preferred_identity": {
            "provider": "email",
            "value": "sample@gmail.com"
          },
          "group_name": "Sub Group 1",
          "plan_name": "Sub Plan 1",
          "duration_length": 2,
          "duration_unit": "weeks",
          "subscription_type": "individual",
          "active": true,
          "payment_amount": "0.00",
          "payment_type": "manual",
          "renewable": true
        }
      ]
    }
    

    It gives all subscriptions for a user.

    LIST All Assets accessible to user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/access/v1/members/me/assets
    
    
    {
       "assets":[
          {
           "metadata":{},
           "title":"public",
           "type":"site"
          }
       ]
    }
    
    

    It gives all assets accessible to a user.

    PATCH Update all subscriptions

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X PATCH http://sketches.quintype.com/api/access/v1/members/me/subscriptions -d '{
      "metadata":  {
        "full-name": "hello-world",
        "email": "hello@quintype.com"
      }
    }'
    
    

    It bulk updates all subscriptions for user.

    PATCH Update a subscription

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X PATCH http://sketches.quintype.com/api/access/v1/members/me/subscriptions/<id> -d '{
      "metadata":  {
        "full-name": "hello-world",
        "email": "hello@quintype.com"
      }
    }'
    
    

    It updates a subscription for user.

    POST Renew a subscription for logged in user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X POST http://sketches.quintype.com/api/access/v1/members/me/subscriptions/<id>/renewals -d '{
      "coupon_code": "",
      "payment": {
          "payment_type": "razorpay",
          "payment_token": "pay_test_8tNiqdiajurOkj",
          "amount_cents": "99900",
          "amount_currency": "INR"
      }
    }'
    
    

    This API can be used to renew any renewable subscription.

    One can use the optional metadata field to set it different from that of the existing subsription. If not passed, it is set to be same as existing subscription.

    POST Create Wallet

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X POST http://sketches.quintype.com/api/access/v1/members/me/subscriber-wallets -d '{
      "subscriber_wallet": {
            "provider": "simpl",
            "metadata": {
                "token": "thenashfsdfvyurn8g9w85gjf"
            }
        }
    }'
    
    
     {
      "subscriber_wallet": {
        "provider": "simpl",
        "metadata": {
          "token": "thenashfsdfvyurn8g9w85gjf"
          }
        }
      }
    

    This API can be used to add/update wallets for a user.

    GET List Wallets

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/access/v1/members/me/subscriber-wallets
    
    
    {
      "subscriber_wallets": ["paytm"]
    }
    
    

    This API can be used to get wallets for a user.

    DELETE Wallets

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/access/v1/members/me/subscriber-wallets -X DELETE
    
    

    This API can be used to delete all wallets of a user.

    GET prices of Assets

    curl -X GET 'http://sketches.quintype.com/api/v1/asset/<asset-type>/pricing-plans?id=123456'
    
    {
        "pricing_plans": [
            {
                "id": 1071,
                "price_cents": 1400,
                "price_currency": "INR",
                "duration_length": 1,
                "duration_unit": "lifetime"
            },
            {
                "id": 1959,
                "price_cents": 1000,
                "price_currency": "INR",
                "duration_length": 1,
                "duration_unit": "months"
            }
        ]
    }
    

    This API returns the prices of a story or a collection when sold individually.

    Parameter Type Occurrence Description
    /<asset-type>/ string 1 The type of asset that is being purchased. Valid Values for Quintype CMS story,collection
    id string 1 The identifier of the story or collection that is being purchased.
    collection_id[] string 0 or many The identifier of the collection that the story belongs to. Used when the value of /<asset-type>/ is story.

    GET Access details with metering

    
    $ curl -H "X-QT-AUTH: <your-auth-token>" -X GET 'https://sketches.quintype.com/api/access/v1/stories/<story-id>/access'
    
    
    
    {
      "granted": true,
      "grantReason": "METERING",
      "data": {
        "numberRemaining": 6,
        "isLoggedIn": true
      }
    }
    
    

    It is a credentialed CORS GET endpoint.

    The properties in the response are:

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user and thin-mint cookie for determining meter identity.

    Element Occurrence Data Type Description
    granted Mandatory boolean true, false Indicates that the user is granted access to the content or not.
    grantReason Mandatory when granted=true enum The reason why access is granted to the user. METERING : The user was granted access as the paywall meter was consumed.SUBSCRIBER : The user was granted access as the user was identified as an active subscriber.
    data.numberRemaining optional integer The number of articles/stories remaining for the user to be granted access to because of the paywall meter. Appears when granted=true and grantReason = METERING when the paywall meter for the user was consumed.
    data.isLoggedIn optional boolean Indicates if the user was logged in or not.

    Note An additional query param disable-meter=true needs to be sent for stories behind hard paywall. Such stories will not be metered and access will be granted only to subscribers.

    POST Pingback and update meter

    
    $ curl -H "Content-Type: text/plain" -X POST 'https://sketches.quintype.com/api/access/v1/stories/<story-id>/pingback -d {
      "granted": true,
      "grantReason": "METERING",
      "data": {
        "numberRemaining": 6,
        "isLoggedIn": true
      }
    }'
    
    
    
    

    It is a credentialed CORS POST endpoint to be used for the Publisher to update metering information. Call this endpoint when the Reader has started viewing the document.

    This API is safe to call from the front end JS, where it will read thin-mint cookie for determining meter identity.

    Important: The pingback JSON object is sent with Content-type: text/plain. This is intentional as it removes the need for a CORS preflight check.

    GET Invoice pdf download

     curl -H "X-QT-AUTH: <your-auth-token>" -X GET 'http://sketches.quintype.com/api/access/v1/members/me/subscriptions/<subscriptionId>/invoices/<invoiceId>/download'
    
    It returns the invoice file in pdf format.
    

    This API is used by publishers on the Quintype platform, to download the invoice in the pdf format.

    Invoice Template Variables

    The below format considers the price inclusive of taxes.

    Name Description
    user_name Name of the user in the accesstype who purchased the subscription
    invoice_number The sequence of invoice number for that account. Example: publisher_name/1, publiser_name/2
    user_email Email of the user in the accesstype who purchased the subscription
    date Date of purchase of subscription. Example: 11 Dec 2018
    payment_method Payment gateway used by the purchaser. Example: razorpay, simpl, paytm
    recurring true if it's a recurring subscription, false if it's a one time payment
    base_price Basic price is the amount receivable by the publisher from the user for the purchase of subscription minus any tax on the product.For example if 110 is the price paid by the user and 10 % if the tax specified by the admin. The base price is calculated by the following formula (110/(1+10/100)), which equals 100
    subscription_group_title The subscription group name, the subscription plan belongs to
    subscription_plan_title The subscription plan name, for which the user purchases a subscription
    subscription_plan_price The price of the subscription plan, specified by the admin without any discount applied
    amount_paid The amount received from the user. If the user applies a discount, discount is applied on the plan amount.
    discount_details It's a hash with following fields code - which represents the discount code applied by the user discount_percentage - which represents the percentage of discount applied discount_amount - which represents the amount of the discount Example: {"code" => "UAT","discount_percentage" => 20,"discount_amount" => "77.97"}
    taxes It's a hash with tax objects. If multiple taxes are specified by the admin, multiple tax objects will be present in this object {"SGST" => {"percentage" => "9.0","amount" => "28.07","currency" => "INR"}, "CGST" => {"percentage" => "9.0","amount" => "28.07","currency" => "INR"} }
    subscription_end_date Represents the end date of the subscription
    dynamic_assets This is applicable for pay per asset type of subscriptions. Suppose if user purchases a storytitle, slug will be available in this field Example: [{id: "some_asset_id", title: "Some title", slug: "/some-slug"}]
    amount_after_discount_before_tax This amount is arrived at, when discount is applied on the base price
    round_off The amount that was rounded off in calculating the amount paid by the subscriber from the calculated base price, price after discount and taxes.

    For Accepting Donations

    The below APIs can be used in all the cases when the identity of the user can be ignored. For example, if you want to accept pure donations and not manage access of any digital content.

    All these APIs are safe to call from the front end JS.

    POST Preview a subscription without login

    curl -H "content-type: application/json" https://sketches.quintype.com/api/access/v1/subscription-without-login/preview -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "coupon_code": "NEWYEAR",
        "payment": {
            "payment_type": "razorpay",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      }
    }
    '
    
    {
      "subscription": {
        "invoices": [],
        "next_payment_due_date": null,
        "deleted_at": null,
        "campaign_name": null,
        "payment_amount_currency": "INR",
        "campaign_subscription": false,
        "campaign_id": null,
        "start_timestamp": "2018-07-24T00:00:00.000Z",
        "assets": [
          {
            "title": "Asset Site Title",
            "metadata": {},
            "type": "site"
          }
        ],
        "end_timestamp": "2018-08-24T00:00:00.000Z",
        "payment_amount": "8.50",
        "discount_detail": {
          "code": "NEWYEAR",
          "discount_type": "percent",
          "title": "New Year offer",
          "value": 15,
          "discounted_price_cents": 850,
          "price_cents": 1000,
          "price_currency": "INR"
        },
        "duration_length": 1,
        "dynamic_assets": {},
        "trial_period_length": null,
        "group_description": "Subscription Group Description",
        "renewable": true,
        "subscription_attempt_id": null,
        "subscription_group_id": 4409,
        "coupon_code": "NEWYEAR",
        "recurring": false,
        "payment_type": "preview",
        "cancelled": false,
        "payment_token": null,
        "updated_at": null,
        "coupon_code_id": 81,
        "plan_amount_cents": 1000,
        "status": "expired",
        "group_name": "Test_Subscription_Group1544522619333",
        "external_id": null,
        "active": false,
        "id": null,
        "plan_occurrence": "One Time",
        "in_grace_period": false,
        "code": null,
        "preferred_identity": {
          "provider": "email",
          "value": "qa20Dec2018123234@quintype.com"
        },
        "plan_amount_currency": "INR",
        "expired": true,
        "payment_id": null,
        "plan_name": "Test ",
        "subscription_plan_id": 5594,
        "duration_unit": "months",
        "trial_period_unit": null,
        "subscription_type": "standard",
        "plan_description": "test",
        "cancelled_at": null,
        "metadata": {
          "mobile": "9844089877",
          "full-name": "hello",
          "email": "hello@quintype.com"
        },
        "renewal_reminder_sent_date": null,
        "created_at": null,
        "subscriber_id": 37104,
        "payment_amount_cents": 850
      },
      "attempt_token": "9r1Sctb2pyvocEkwhp1U5Sfq",
      "external_reference_id": null
    }
    

    It returns a preview for a Subscription, without creating a new subscription. For a successful subscription, it also return an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back along with subscription creation API. We highly recommend use of this API before accepting payment form a user.

    POST Create Subscription without login

    curl -H "content-type: application/json" https://sketches.quintype.com/api/access/v1/subscription-without-login -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "coupon_code": "NEWYEAR",
        "payment": {
            "payment_type": "razorpay",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      }
    }
    '
    
    {
        "subscription": {
            "invoices": [
                {
                    "amount_after_discount_before_tax": "122.03",
                    "amount_currency": "INR",
                    "id": 990,
                    "invoice_taxes": {
                        "SGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        },
                        "CGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        }
                    },
                    "amount_cents": 14400,
                    "base_price": "152.54",
                    "sequenced_invoice_number": "BQ/1819/SUB/167",
                    "discount_details": {
                        "code": "UAT",
                        "discount_percentage": 20,
                        "discount_amount": "30.51"
                    },
                    "created_at": "2018-12-12T10:25:48.590Z"
                }
            ],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": 96595,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "razorpay",
            "cancelled": false,
            "payment_token": "pay_BWpQWQcLLK3L37",
            "updated_at": "2018-12-12T10:25:48.494Z",
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": 32405,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "quintype",
                "value": "251933"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": 32379,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": "2018-12-12T10:25:48.494Z",
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        }
    }
    

    This API can be used to create a subscription.

    Here attempt_token is the token received from preview.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    [DEPRECATED] For Platform Customers

    The below APIs are deprecated. Please use this instead.

    The customers of Quintype platform can use below APIs for subscriptions in Accesstype.

    [Deprecated] POST Preview a subscription without login

    curl -H "content-type: application/json" https://sketches.quintype.com/api/v1/members/me/subscriptions/preview-without-login -d '{
        "member": {
          "email": "example@gmail.com"
        },
        "subscription": {
          "subscription_plan_id": "11",
          "coupon_code": "NEWYEAR",
          "payment": {
              "payment_type": "razorpay",
              "amount_cents": "99900",
              "amount_currency": "INR"
          },
          "metadata":  {
              "full-name": "hello",
              "email": "hello@quintype.com"
          },
          "start_timestamp": "2017-09-21 00:00:00"
      }
    }
    '
    
    {
      "subscription": {
        "invoices": [],
        "next_payment_due_date": null,
        "deleted_at": null,
        "campaign_name": null,
        "payment_amount_currency": "INR",
        "campaign_subscription": false,
        "campaign_id": null,
        "start_timestamp": "2018-07-24T00:00:00.000Z",
        "assets": [
          {
            "title": "Asset Site Title",
            "metadata": {},
            "type": "site"
          }
        ],
        "end_timestamp": "2018-08-24T00:00:00.000Z",
        "payment_amount": "8.50",
        "discount_detail": {
          "code": "NEWYEAR",
          "discount_type": "percent",
          "title": "New Year offer",
          "value": 15,
          "discounted_price_cents": 850,
          "price_cents": 1000,
          "price_currency": "INR"
        },
        "duration_length": 1,
        "dynamic_assets": {},
        "trial_period_length": null,
        "group_description": "Subscription Group Description",
        "renewable": true,
        "subscription_attempt_id": null,
        "subscription_group_id": 4409,
        "coupon_code": "NEWYEAR",
        "recurring": false,
        "payment_type": "preview",
        "cancelled": false,
        "payment_token": null,
        "updated_at": null,
        "coupon_code_id": 81,
        "plan_amount_cents": 1000,
        "status": "expired",
        "group_name": "Test_Subscription_Group1544522619333",
        "external_id": null,
        "active": false,
        "id": null,
        "plan_occurrence": "One Time",
        "in_grace_period": false,
        "code": null,
        "preferred_identity": {
          "provider": "email",
          "value": "qa20Dec2018123234@quintype.com"
        },
        "plan_amount_currency": "INR",
        "expired": true,
        "payment_id": null,
        "plan_name": "Test ",
        "subscription_plan_id": 5594,
        "duration_unit": "months",
        "trial_period_unit": null,
        "subscription_type": "standard",
        "plan_description": "test",
        "cancelled_at": null,
        "metadata": {
          "mobile": "9844089877",
          "full-name": "hello",
          "email": "hello@quintype.com"
        },
        "renewal_reminder_sent_date": null,
        "created_at": null,
        "subscriber_id": 37104,
        "payment_amount_cents": 850
      },
      "attempt_token": "9r1Sctb2pyvocEkwhp1U5Sfq",
      "external_reference_id": null
    }
    

    This API can be used to preview a subscription when user is not logged in.

    It returns a preview for a Subscription, without creating a new subscription. For a successful subscription, it also return an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back with register & subscribe api or subscribe without login api to mark an attempt as success.

    We highly recommend use of this API before accepting payment form a user.

    [Deprecated] POST Preview a subscription for logged in user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "content-type: application/json" https://sketches.quintype.com/api/v1/api/v1/members/me/subscriptions/preview -d '{
      "subscription": {
        "subscription_plan_id": "11",
        "coupon_code": "NEWYEAR",
        "payment": {
            "payment_type": "razorpay",
            "amount_cents": "99900",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2017-09-21 00:00:00"
      }
    }
    '
    
      {
        "subscription": {
            "id": null,
            "subscriber_id": 8302,
            "subscription_plan_id": 11,
            "created_at": null,
            "updated_at": null,
            "assets": [],
            "start_timestamp": "2218-09-29T19:54:02.833Z",
            "end_timestamp": "2318-09-29T19:54:02.833Z",
            "deleted_at": null,
            "payment_id": null,
            "metadata": {
              "full-name": "hello",
              "email": "hello@quintype.com"
            },
            "external_id": null,
            "trial_period_length": null,
            "trial_period_unit": null,
            "code": null,
            "discount_detail": {},
            "coupon_code_id": null,
            "campaign_id": null,
            "plan_amount_cents": 50000,
            "plan_amount_currency": "INR",
            "duration_unit": "lifetime",
            "duration_length": 1,
            "plan_name": "life time ",
            "plan_description": "life time ",
            "group_name": "prod test 30 aug",
            "group_description": "prod test 30 aug",
            "subscription_type": "standard",
            "plan_occurrence": "One Time",
            "subscription_attempt_id": null,
            "renewal_reminder_sent_date": null,
            "dynamic_assets": {},
            "subscription_group_id": 2313,
            "preferred_identity": {
                "provider": "email",
                "value": "biswajit+29@quintype.com"
            },
            "active": false,
            "payment_amount": "0.00",
            "payment_amount_cents": 0,
            "payment_amount_currency": "USD",
            "payment_type": "manual",
            "payment_token": null,
            "renewable": false,
            "status": "pending",
            "expired": false,
            "coupon_code": "NEWYEAR,
            "campaign_name": null,
            "campaign_subscription": false,
            "recurring": false,
            "cancelled_at": null,
            "next_payment_due_date": null,
            "cancelled": false,
            "in_grace_period": false
        },
        "attempt_token": "SSLvhLBEWiMxcEiMKgHxATpJ",
        "external_reference_id": null
    }
    

    It returns a preview for a Subscription, without creating a new subscription. For a successful subscription, it also return an attempt_token.

    An attempt_token is the identifier of a subscription attempt. It should be sent back with create-subscription api.

    We highly recommend use of this API before accepting payment form a user.

    [Deprecated] POST Register And Subscribe without login

    curl -H "X-QT-AUTH: sample-auth" -H "Content-Type: application/json" http://sketches.quintype.com/api/v1/register-and-subscribe -d '{
       "member": {
            "email": "ace33@quintype.com",
            "username": "ace 33",
            "password": "password",
            "name": "ace 33",
            "dont-login": false
        },
        "options": {
            "gateway-name": "razorpay"
        },
        "payment": {
            "attributes": {
                "currency": "INR",
                "amount": 100,
                "payment-type": "Razorpay",
                "gateway-payment-id": "pay_123trt465",
                "attributes": ""
            }
        },
        "subscription": {
            "accesstype-plan-id": 4,
            "metadata": {
              "city": "Bangalore",
              "state": "Karnataka",
              "house": "Old Airport Road, Murugeshpallya, Bangalore",
              "street": "Old Airport Road, Murugeshpallya, Bangalore",
              "landmark": "Karnataka",
              "pincode": "560017",
              "mobile": "8129612361"
             },
             "coupon-code": "HOLI"
        },
        "attempt-token": "attempt-token"}
    '
    
    
    {
        "subscription": {
            "invoices": [
                {
                    "amount_after_discount_before_tax": "122.03",
                    "amount_currency": "INR",
                    "id": 990,
                    "invoice_taxes": {
                        "SGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        },
                        "CGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        }
                    },
                    "amount_cents": 14400,
                    "base_price": "152.54",
                    "sequenced_invoice_number": "BQ/1819/SUB/167",
                    "discount_details": {
                        "code": "UAT",
                        "discount_percentage": 20,
                        "discount_amount": "30.51"
                    },
                    "created_at": "2018-12-12T10:25:48.590Z"
                }
            ],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": 96595,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "razorpay",
            "cancelled": false,
            "payment_token": "pay_BWpQWQcLLK3L37",
            "updated_at": "2018-12-12T10:25:48.494Z",
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": 32405,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "quintype",
                "value": "251933"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": 32379,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": "2018-12-12T10:25:48.494Z",
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        }
    }
    

    Registers a member and creates subscription in Accesstype. To be used for users that have not logged in. It returns X-QT-AUTH in response headers.

    gateway-name can be any valid payment-type supported by Accesstype.

    accesstype-plan-id is the Id of plan in Accesstype.

    attempt-token can be fetched using preview api. This is an optional parameter but we advice you to use it for better tracking of transactions.

    [Deprecated] POST Create Subscription for logged in user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X POST http://sketches.quintype.com/api/v1/members/me/subscriptions -d '{
      "subscription": {
        "subscription_plan_id": "2118",
        "coupon_code": "UAT",
        "payment": {
            "payment_type": "razorpay",
            "payment_token": "pay_BWpQWQcLLK3L37",
            "amount_cents": "14400",
            "amount_currency": "INR"
        },
        "metadata":  {
            "full-name": "hello",
            "email": "hello@quintype.com"
        },
        "start_timestamp": "2018-09-21 00:00:00"
      },
      "attempt_token": "fo4bMWjP6N5vtVySNtiAUNBQ"
    }'
    
    {
        "subscription": {
            "invoices": [
                {
                    "amount_after_discount_before_tax": "122.03",
                    "amount_currency": "INR",
                    "id": 990,
                    "invoice_taxes": {
                        "SGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        },
                        "CGST": {
                            "percentage": "9.0",
                            "amount": "10.98",
                            "currency": "INR"
                        }
                    },
                    "amount_cents": 14400,
                    "base_price": "152.54",
                    "sequenced_invoice_number": "BQ/1819/SUB/167",
                    "discount_details": {
                        "code": "UAT",
                        "discount_percentage": 20,
                        "discount_amount": "30.51"
                    },
                    "created_at": "2018-12-12T10:25:48.590Z"
                }
            ],
            "next_payment_due_date": null,
            "deleted_at": null,
            "campaign_name": null,
            "payment_amount_currency": "INR",
            "campaign_subscription": false,
            "campaign_id": null,
            "start_timestamp": "2021-08-07T11:28:46.271Z",
            "assets": [
                {
                    "title": "Site",
                    "metadata": {},
                    "type": "site"
                },
                {
                    "title": "Monthly magazines",
                    "metadata": {},
                    "type": "static"
                },
                {
                    "title": "All exclusive reportage content",
                    "metadata": {
                        "access_level": 400
                    },
                    "type": "story"
                },
                {
                    "title": "All paid stories",
                    "metadata": {
                        "access_level": 300
                    },
                    "type": "story"
                },
                {
                    "title": "All Story",
                    "metadata": {
                        "access_level": "999"
                    },
                    "type": "story"
                }
            ],
            "end_timestamp": "2021-11-07T11:28:46.271Z",
            "payment_amount": "144.00",
            "discount_detail": {
                "code": "UAT",
                "discount_type": "percent",
                "title": "UAT Trial",
                "value": 20,
                "discounted_price_cents": 14400,
                "price_cents": 18000,
                "price_currency": "INR"
            },
            "duration_length": 3,
            "dynamic_assets": {},
            "trial_period_length": null,
            "group_description": "Silver + Access to Exclusive Reportage + Monthly round-up magazines",
            "renewable": false,
            "subscription_attempt_id": 96595,
            "subscription_group_id": 2197,
            "coupon_code": "UAT",
            "recurring": false,
            "payment_type": "razorpay",
            "cancelled": false,
            "payment_token": "pay_BWpQWQcLLK3L37",
            "updated_at": "2018-12-12T10:25:48.494Z",
            "coupon_code_id": 82,
            "plan_amount_cents": 18000,
            "status": "pending",
            "group_name": "Unlimited",
            "external_id": null,
            "active": false,
            "id": 32405,
            "plan_occurrence": "One Time",
            "in_grace_period": false,
            "code": null,
            "preferred_identity": {
                "provider": "quintype",
                "value": "251933"
            },
            "plan_amount_currency": "INR",
            "expired": false,
            "payment_id": 32379,
            "plan_name": "3 months",
            "subscription_plan_id": 2118,
            "duration_unit": "months",
            "trial_period_unit": null,
            "subscription_type": "standard",
            "plan_description": "All assets ",
            "cancelled_at": null,
            "metadata": {
                "mobile_number": "7639817688"
            },
            "renewal_reminder_sent_date": null,
            "created_at": "2018-12-12T10:25:48.494Z",
            "subscriber_id": 9311,
            "payment_amount_cents": 14400
        }
    }
    

    This API can be used to create a subscription.

    Here attempt_token is the token received from preview.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    [Deprecated] LIST All subscriptions of a user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/v1/members/me/subscriptions
    
    
    {
      "subscriptions": [
        {
          "invoices": [
            {
              "amount_after_discount_before_tax": "122.03",
              "amount_currency": "INR",
              "id": 990,
              "invoice_taxes": {
                "SGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                },
                "CGST": {
                  "percentage": "9.0",
                  "amount": "10.98",
                  "currency": "INR"
                }
              },
              "amount_cents": 14400,
              "base_price": "152.54",
              "sequenced_invoice_number": "BQ/1819/SUB/167",
              "discount_details": {
                "code": "UAT",
                "discount_percentage": 20,
                "discount_amount": "30.51"
              },
              "created_at": "2018-12-12T10:25:48.590Z"
            }
          ],
          "id": 713,
          "subscriber_id": 453,
          "subscription_plan_id": 16,
          "created_at": "2017-10-30T10:55:42.201Z",
          "updated_at": "2017-10-30T10:55:42.201Z",
          "assets": [
            {
              "metadata": {},
              "title": "public",
              "type": "site"
            }
          ],
          "start_timestamp": "2017-10-30T10:55:42.176Z",
          "end_timestamp": "2017-11-13T10:55:42.176Z",
          "deleted_at": null,
          "payment_id": 668,
          "metadata": {
            "Name": "Sample User",
            "Address": "Sample add",
            "Phone Number": "1111111111"
          },
          "external_id": null,
          "trial_period_length": null,
          "trial_period_unit": null,
          "coupon_code": null,
          "subscription_group_id": 21,
          "preferred_identity": {
            "provider": "email",
            "value": "sample@gmail.com"
          },
          "group_name": "Sub Group 1",
          "plan_name": "Sub Plan 1",
          "duration_length": 2,
          "duration_unit": "weeks",
          "subscription_type": "individual",
          "active": true,
          "payment_amount": "0.00",
          "payment_type": "manual",
          "renewable": true
        }
      ]
    }
    

    It gives all subscriptions for a user.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    [Deprecated] LIST All Assets accessible to user

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" http://sketches.quintype.com/api/v1/members/me/assets
    
    
    {
       "assets":[
          {
           "metadata":{},
           "title":"public",
           "type":"site"
          }
       ]
    }
    
    

    It gives all assets accessible to a user.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    [Deprecated] PATCH Update a subscription

    curl -H "X-QT-AUTH: <your-auth-token>" -H "Content-Type: application/json" -X PATCH http://sketches.quintype.com/api/v1/members/me/subscriptions/<id> -d '{
      "metadata":  {
        "full-name": "hello-world",
        "email": "hello@quintype.com"
      }
    }'
    
    

    It updates a subscription for user.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    [Deprecated] GET Access details

     curl -H "X-QT-AUTH: <your-auth-token>" -X GET 'http://sketches.quintype.com/api/v1/stories/<story-id>/access-data'
    
     {
        "access-data": {
            "name": "subtype"
        }
     }
    

    This API can be used to get access details of any story for a user.

    It returns 403 if the story is not accessible to user, else 200.

    This API is safe to call from the front end JS, where it will read session-cookie to determine the current user. Backend callers can use X-QT-AUTH for the same purpose.

    AMP Subscriptions

    The amp-subscriptions extensions implements the subscription-style access/paywall rules.

    There could be a local service or vendor services.

    A local service is configured fully within the page, including its authorization/pingback endpoints, as well as login and subscribe actions. The properties in the "local" service are:

    The customers of Quintype platform can use below APIs for amp-subscriptions in Accesstype.

    GET Authorization endpoint

    
    $ curl -X GET 'https://sketches.quintype.com/api/access/v1/stories/<story-id>/amp-access?readerId=<reader-id>'
    
    
    
    {
      "granted": true,
      "grantReason": "METERING",
      "data": {
        "numberRemaining": 6,
        "isLoggedIn": true
      }
    }
    
    

    It is a credentialed CORS GET endpoint.

    The properties in the response are:

    Note An additional query param disable-meter=true needs to be sent for stories behind hard paywall. Such stories will not be metered and access will be granted only to subscribers.

    POST Pingback endpoint

    
    $ curl -H "Content-Type: text/plain" -X POST 'https://sketches.quintype.com/api/access/v1/stories/<story-id>/amp-pingback?readerId=<reader-id> -d {
      "granted": true,
      "grantReason": "METERING",
      "data": {
        "numberRemaining": 6,
        "isLoggedIn": true
      }
    }'
    
    
    
    

    It is a credentialed CORS POST endpoint. AMP Runtime calls this endpoint automatically when the Reader has started viewing the document. One of the main goals of the Pingback is for the Publisher to update metering information.

    Important: The pingback JSON object is sent with Content-type: text/plain. This is intentional as it removes the need for a CORS preflight check.

    FAQ

    This section details out the steps needed for you to get started with Accesstype

    Pre-requisite:

    Your Razorpay merchant account must be created.

    Step 1: Setup API Keys and Secret:

    Step 2: Setup Webhooks:

    Your Razorpay and Accesstype accounts will now be linked.

    Release Notes

    This section contains important Accestype release notes. For any queries, please write to us at support@quintype.com.

    19 Aug 19 Release Note - Accesstype

    1. Attempts CSV report now contains the payment gateway that was used by the potential subscriber to perform the attempt to subscribe.
    2. [Bug fix] - Add identity now trims leading and trailing spaces when Accesstype user adds an email.
    3. [Bug fix] - Paywall meter cookie is now persistent on exiting the browser application.

    8 Aug 19 Release Note - Accesstype

    1. Update Subscriber metadata - Subscriber information can now be updated by using Accesstype JS.
    2. Manual Subscriptions can now be created and Amount Paid can be captured by Accesstype Owners using the dashboard. Go to Accesstype.com > Subscribers > Add new user or find a user by entering email > Select the Group and Plan > Enter Amount paid and notes if any > Click on Save. Accesstype Manual Subscription Creation Amount Paid

    5 August 19 Release Note - Accesstype

    1. Outgoing Webhooks (update) - Subscriber Creation webhook is an additional event that is now available for use. Time-outs are now applied to the webhook call that are made to third party systems. Time-outs are set at 10s to establish a connection and 5s to receive a response to the POST API calls.
    2. Skip payment gateway Accesstype now allows subscriptipons to be created when no amount is required to be paid. This may happen when the price of the plan is set to 0 or when the entire plan amount is discounted using a coupon code.

    30 Jul 19 Release Note - Accesstype

    1. Juspay payment now opens up in a new tab instead of a new pop-up window.

    26 Jul 19 Release Note - Accesstype

    1. Outgoing Webhooks (update) - Subscription Activation and Subscription Entered Grace Period are the events that are additionally available for use.

    19 Jul 19 Release Note - Accesstype

    1. Outgoing Webhooks (update) - Subscription Creation, Subscription Cancellation and Subscription Renewal are the events that are additionally available for use.

    1 Jul 19 Release Note - Accesstype

    1. Outgoing Webhooks - Accesstype now has the ability to make webhook calls to third party systems on specific events. Click here to know more about Accesstype webhooks, how to set up webhooks, a description of the events and how to verify the webhooks sent by Accesstype.

    As part of this release, the Subscription Expiry event is available for use.

    27 Jun 19 Release Note - Accesstype

    1. Cloudfalre purge optimisations.

    25 Jun 19 Release Note - Accesstype

    1. Subscription Preview and Subscription Create without a login, are now allowed in Accesstype.js and served from the Cloudflare edge worker.

    21 Jun 19 Release Note - Accesstype

    1. Accesstype is now integrated with Voucherify so Discount and Referral vouchers can be applied redeemed by subscribers in One-Time subscriptions and Pay Per Asset subscriptions.

    18 Jun 19 Release Note - Accesstype

    1. Get Subscriptions and Get Assets APIs are now available in Accesstype.js and served from the Cloudflare Edge worker.

    13 Jun 19 Release Note - Accesstype

    1. Use publisher domain specific cookie for Paywall meter.

    29 May 19 Release Note - Accesstype

    1. Razorpay proactive subscription creation bug fixes.

    20 May 19 Release Note - Accesstype

    1. Access grant API now served from the Cloudflare edge worker.

    10 May 19 Release Note - Accesstype

    1. Juspay payment optimisations.

    24 Apr 19 Release Note - Accesstype

    1. Paywall meter and Coudflare purge optimisations.

    17 Apr 19 Release Note - Accesstype

    1. Consolidated Daily Subscription Report: This daily subscription report contains Subscription details, payment information, tax invoice data and subscriber information for Plan based subscriptions, PPA purchases and Campaign subscriptions, all in one file.

    This CSV report is generated daily for the previous day and is available at

    Accesstype > Analytics > Reports

    Accesstype Consolidated Daily Subscription Report

    11 Apr 19 Release Note - Accesstype

    1. Accesstype now uses serverless computing technology for increased efficiency in performance, scalability and resilience.

    29 Mar 19 Release Note - Accesstype

    1. CSV reports now include Payment Transaction Date for better reconciliation of Recurring subscriptions.
    2. Bug fix: The Manage Subscription Plan and Group had hidden buttons.
    3. Bug fix: Recheck Paytm transaction status when it is in pending state.

    28 Mar 19 Release Note - Accesstype

    1. CSV reports now include the International Payment column to help identify those payments that are made using international cards.

    Note: This is applicable to Razorpay payment gateway only.

    18 Feb 19 Release Note - Accesstype

    1. Juspay integration - Integration with payment aggregator Juspay for iframe type of integration. Juspay's algorithms choose the best payment gateways for best success rates and also take into account pre-defined priority logic to offer the most efficient payment option to customers. To create a Merchant account on Juspay write to support@juspay.in. Accesstype Juspay

    2. Analytics Dashboard - Monthly and daily insights into the total number of subscriptions that are created. Accesstype Analytics Subscription Count

    4 Jan 19 Release Note - Accesstype

    1. Updated Subscription CSV Report - The subscription CSV Report now contains additional fields for financial related purposes: Base Price, Discount amounts, amount after discount before tax and round-off.
    2. Subscriber Name - The Subscriber name is now displayed in Accesstype UI as well as the CSV report by default, for all subscriptions, Pay Per Asset purchases and Campaign Patrons. Subscriber Name in UI
    3. Getsimpl workflow upgrades - Optimizations and security enhancements on Simpl payment option workflow.
    4. Bug fixes - Subscription CSV Report - Duplicate entires for recurring subscriptions are elimiated and tax amounts are displayed under the appropriate columns.

    12 Dec 18 Release Notes - Accesstype

    New Features:

    1. Invoicing and Taxes - Set up tax names and rates for generating Invoices. The tax rates set up in this module are applied and tax amounts calculated such that the price of the plan/asset is inclusive of taxes. Tax Settings
    2. HTML Template for Invoices - Upload the HTML invoice using Accesstype. The template can include a bunch of variables that are listed here. The Invoice Sequence Prefix of your choice can also be updated. Write to us at support@quintype.com to reset the invoice sequence number. Invoice Settings

    3. API for PDF invoice download - The API end point to download PDF invoices for a given subscription is available here for those on Quintype platform and here for those not on the Quintype platform. Note: The method to invoke the download Invoice PDF API call can also be made using the AccesstypeJS which is described here and here.

    11 Oct 18 Release Notes - Accesstype

    New Features:

    1. Paytm Payment Gateway - Auto Debit - Accept one-click payments for individual stories using Paytm wallets. Customers can link their wallet and purchase individual stories by just a single click. Paytm Auto Debit Payment Gateway The Paytm Auto Debit option can be used via the Accesstype JS. Documentation available here: Accesstype.js link 1 Accesstype.js link 2 Coming soon: Paytm-Auto Debit on standard plans.

    2. URLs of reports generated in Accesstype, are now signed using private URLs and have an expiry for enhanced security.

    24 Sep 18 Release Notes - Accesstype

    New Features:

    1. Accesstype Javascript - Publishers on the Quintype platform can now easily integrate with Payment Gateways/Wallets as well as set up conversations with Accesstype servers, all in one place using methods in accesstype.js

      1. Pay Per Asset(PPA) APIs to get the price of a story, view available payment options for the user, purchase stories can be called using methods available in Accesstype.js
      2. Accept payments from Simpl payment gateway using accesstype.js for both traditional plans as well as for individual stories(PPA)
      3. Accept payments from Razorpay payment gateway using accesstype.js for both traditional plans as well as for individual stories(PPA) Documentation links: Accesstype.js link 1 Accesstype.js link 2 Note: To integrate accesstype.js with your website, please get in touch with your account managers or contact us at support@quintype.com
    2. Pay Per Asset(PPA) - Publishers on the Quintype platform can now sell each story(a.k.a asset) individually. Set up pricing for stories and view all purcchases of individual stories using the Accesstype application. PPA Set Price PPA Purchases

    3. New Payment Gateway - Simpl - Publishers can activate and use the Simpl payment gateway options for frictionless payments. Also available in the Accesstype.js Simpl PG

    4. Menu restructure - The Accesstype menu is now restructured for easy navigation and segregation of subscription/purchase information.

    Accesstype Menu

    1. Encryption of Wallet token.

    6 Aug 18 Release Notes - Accesstype

    Enhancements and bug fixes:

    1. Wallets API - Link wallets of Simpl and PayTm with publishers. Documentation available here
    2. Emails sent out to subscribers have a new look.
    3. Enhancements to help reconcile subscription failures using Android Pay if any.
    4. Minor bug fixes.

    10 Jul 18 Release Notes - Accesstype

    Enhancements and bug fixes:

    1. Updated the Subscriptions Report to include Plan names of the group, Subscription Created Date and Subscription Start Date.
    2. Security and user concurrency upgrades.

    28 Jun 18 Release Notes - Accesstype

    Enhancements and bug fixes:

    1. Accesstype users will now have their activities within the application, logged in the database.
    2. Users will now know the account that they are actively working on. Account Display
    3. Optimisation in payment gateway integration: Subscription attempts, sucscription creations and multiple payments associated with a subscription are now traceable.
    4. Users can now get instant help using the help chat. Support
    5. Easy access link to Accesstype documentation.
    6. [Bug fix] Razorpay payment transaction amounts rounded down in CSV reports
    7. Other bug fixes.