Subscriptions

Both the Zlick SDK and widget allow you to accept recurring-payments for the subscriptions you offer.

When creating an account with Zlick, you have to define the subscription plans you offer in advance. These plans are stored in the Zlick database and to activate this subscription for a certain user, you just have to refer to it by its unique name.

A typical subscription plan has the following properties:

When the onboarding process is complete, you can then refer to this subscription and start activating it for users on your site through the subscription's unique name.

Subscription Flow

The following chart might help you understand the flow of subscriptions on the Zlick platform.

Zlick Subscriptions Flow

Webhook Callback

The webhook callback is sent to the 'Webhook callback' url you define during the onboarding process. The webhook contains the following properties:

Method : POST

Content Type : application/json

Body : Webhook object (defined below)

Webhook Objects

Webhook object is different depending on whether it is a subscription callback or transaction callback and whether or not it was a success or a failure.

Subscription

Success
{
  desc: 'success',
  clientUserId: 'u1234', // userid in the client system. Provided if the optional paramter `clientUserId` is sent along with purchase payload
  productId: 'subs-123', // unique product id defined during onboarding
  price: 150, // price charged from user
  subscriptionId: '12344552XXX' // unique ID of this subscription
}
Error
{
  desc: 'Payment declined', // Error reason
  clientUserId: 'u1234', // userid in the client system. Provided if the optional paramter `clientUserId` is sent along with purchase payload
  errorCode: 'ZLICK04', // Zlick error codes. See below
  productId: 'subs-123' // unique ID of this subscription
}

Transaction

Success
{
  desc: 'success',
  clientUserId: 'u1234', // userid in the client system. Provided if the optional paramter `clientUserId` is sent along with purchase payload
  status: 'COMPLETED',
  productId: 'subs-123', // unique product id defined during onboarding
  price: 150, // price charged from user
  tmsTransactionId: 'XXXXXXXXXX', // client transaction id
  zlickTransactionId: 'XXXXXXXXXXX' // zlick transaction id
}
Error
{
  desc: 'Payment declined', // Error reason
  clientUserId: 'u1234', // userid in the client system. Provided if the optional paramter `clientUserId` is sent along with purchase payload
  status: 'CANCELED',
  errorCode: 'ZLICK04', // Zlick error codes. See below
  productId: 'subs-123', // unique product id defined during onboarding
  price: 150, // price charged from user
  tmsTransactionId: 'XXXXXXXXXX', // client transaction id
  zlickTransactionId: 'XXXXXXXXXXX' // zlick transaction id
}

Zlick Error Codes