Subscription Event Structure

Subscription Event

Property Name

Description

event* (required)

"event": "subscription"
value should be in small case. (Like 'order' NOT 'ORDER')

properties*
(required)

"properties": {
  "orderId": "1234"
  "amount": 100.25
  "status": "pending"
}

Required properties

All properties related to order should be present inside properties, You be sent your custom event properties here too.

user_properties*
(required)

"user_properties": {
  "uid": '123456' //require properties, unique id of customer.
  "email": "[email protected]",
  "phone": "123-456-7890"
}


All properties related to customer should be present inside userProperties, You be sent your custom user properties here too.

time*
(required)

"time": {
sentAt: 1629131492259
}
sentAt : The date and time when the event was sent.

appClientId*
(required)

"appClientId": "API_KEY"
Unique id represent the source in Richpanel.
Change for each website, can be found in Richpanel app.

Subscription Properties

Property Name

Description

orderId* (required)

"orderId": "1234"
Unique id of order.

orderDbKey
(required)

"orderDbKey": 876541234
If the order has a different database id, it must be provided here or can be kept the same as orderId. We use this to create a link to the order management portal.

amount*
(required)

"amount": 100.25
Total amount of the order.

start

"2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the subscription started

end

"2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the subscription ends. Leave it empty if it is unknown

nextPayment

"2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the next payment happens for the subscription

lastPayment

"2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the last payment happens for the subscription. Leave it empty if it is unknown

trialEnd

"2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the trial ends for the subscription. Leave it empty if it is unknown

createdAt

"createdAt": "2025-01-05T17:28:18+00:00"
The date and time (ISO 8601 format) when the subscription was created.

status

"status": "active"
Example: active, expired, cancelled, paused or any custom text.
Something that suits your system.

shippingPhone
shippingEmail
shippingFirstName
shippingLastName
shippingAddressLine1
shippingAddressLine2
shippingCity
shippingState
shippingCountry
shippingPostcode

All string properties, and optional

  • *shippingPhone**: The phone number at the shipping address.
  • *shippingEmail**: The Email at the shipping address.
  • *shippingFirstName**: The first name of the person associated with the shipping address.
  • *shippingLastName**: The last name of the person associated with the shipping address.
  • *shippingAddressLine1**: The street address of the shipping address.
  • *shippingAddressLine2**: An optional additional field for the street address of the shipping address.
  • *shippingCity**: The city, town, or village of the shipping address.
  • *shippingState**: The name of the region (for example, province, state, or prefecture) of the shipping address.
  • *shippingCountry**: The name of the country of the shipping address.
  • *shippingPostcode**: The postal code (for example, zip, postcode, or Eircode) of the shipping address.

items*
(required)

"items": [{
"id": "2493989519418",
"price": 49.99,
"optionId": "31858336956474",
"sku": "A31SSUJZ99COMTL1",
"name": "My Product - L",
"grams": 454,
"quantity": 1,
}][{ "id": "2493989519418", "price": 49.99, "optionId": "31858336956474", "sku": "A31SSUJZ99COMTL1", "name": "My Product - L", "grams": 454, "quantity": 1, }]

  • *id**: The ID of the product.
  • *price**: Price for single quantity of the variant product.
  • *quantity**:The number of items that were purchased.
  • *optionId**: The ID of the product variant.
  • *sku**: The item's SKU (stock keeping unit).
  • *name**: The name of the product variant.
  • *grams**: The weight of the item in grams.

User Properties Object (user_properties)

Example:
{
event: "subscription",
properties: {},
userProperties: {} // User Properties
}

Property Name

Description

uid* (required)

Unique Id of the user.

phone

Phone number of the user.

email

Email address of the user.

firstName

First name of the user

lastName

Last name of the user.

billingAddress

"billingAddress": {
"firstName": "Shubhanshu",
"lastName": "Chouhan",
"city": "LOCKPORT",
"state": "Illinois",
"stateCode": "IL",
"country": "United States",
"countryCode": "US",
"postcode": "60441",
"phone": null,
"address1": "201B, lotus chs",
"address2": "",
"company": ""
},

Billing details of the customer.

shippingAddress

"shippingAddress": {
"firstName": "Shubhanshu",
"lastName": "Chouhan",
"city": "LOCKPORT",
"state": "Illinois",
"stateCode": "IL",
"country": "United States",
"countryCode": "US",
"postcode": "60441",
"phone": null,
"address1": "201B, lotus chs",
"address2": "",
"email": "[email protected]"
},
Shipping details of the user.

Custom Properties

Any other properties which belong's to user.

Sample Order Event

{
	"event": "subscription",
	"properties": {
		"orderId": "11111",
		"email": "[email protected]",
		"amount": 169.97, //required
    "start":  "2025-01-05T17:28:18+00:00",
    "trialEnd":  "2025-01-05T17:28:18+00:00", //leave it empty if not available
    "nextPayment": "2025-01-05T17:28:18+00:00",
    "lastPayment":  "2025-01-05T17:28:18+00:00", //leave it empty if not available
    "end": "2025-02-05T17:28:18+00:00", //leave it empty if not available
    "shippingPhone": null,
		"shippingCity": "LOCKPORT",
		"shippingPostcode": "60441",
		"shippingState": "Illinois",
		"shippingCountry": "United States",
		"shippingAddressLine1": "201B, lotus CHS",
		"shippingAddressLine2": "",
		"shippingFirstName": "Shubhanshu",
		"shippingLastName": "Chouhan",
    "status": "active",
		"items": [{ //required
				"id": "2493989519418",
				"price": 49.99, //required
				"optionId": "31858336956474",
				"sku": "A31SSUJZ99COMTL1",
				"name": "My Product - L",
				"grams": 454,
				"quantity": 1, //required
				"imageURL": [
					"https://cdn.abc.com/s/files/1/1067/2582/products/product1.jpg?v=1605207140"
				]
			},
			{
				"id": "4586759913530",
				"price": 49.99,
				"optionId": "32132068311098",
				"sku": "A31SSUGI85ODGDM1",
				"name": "My Product - M",
				"grams": 454,
				"quantity": 1,
				"imageURL": [
					"https://cdn.abc.com/s/files/1/1067/2582/products/product2.jpg?v=1605207140"
				]
			}
		]
	},
	"user_properties": { //required
		"uid": "[email protected]", //required, Customer user id in database
		"phone": null,
		"email": "[email protected]",
		"firstName": "Shubhanshu",
		"lastName": "Chouhan",
		"billingAddress": {
			"firstName": "Shubhanshu",
			"lastName": "Chouhan",
			"city": "LOCKPORT",
			"state": "Illinois",
			"stateCode": "IL",
			"country": "United States",
			"countryCode": "US",
			"postcode": "60441",
			"phone": null,
			"address1": "201B, lotus chs",
			"address2": "",
			"company": ""
		},
		"shippingAddress": {
			"firstName": "Shubhanshu",
			"lastName": "Chouhan",
			"city": "LOCKPORT",
			"state": "Illinois",
			"stateCode": "IL",
			"country": "United States",
			"countryCode": "US",
			"postcode": "60441",
			"phone": null,
			"address1": "201B, lotus chs",
			"address2": "",
			"email": "[email protected]"
		},
	},
	"time": {
		"sentAt": "2025-01-05T17:28:18+00:00" //when event occurred, use this property in case you're updating old orders, or synchronizing old orders
	},
	"appClientId": "API_KEY" //change for each website, can be found in Richpanel app.
}

API Reference:https://developer.richpanel.com/reference/create-a-subscription

Note:

  • Make sure to follow the proper format
  • Don't send empty values.