Subscription Events

Subscription Event Object

NameTypeDescriptionExample
idstrIdentifier of the event“mmmm4444nnnn3333pppp”
typestrThe type of event that occurredSee below for full list of event types
createdintTime since epoch when the event occurred1622589211
dataobjectTypeSee JSON below
data.object.typestrResource type of event"Subscription"
data.object.merchantstrIdentifier of merchant"aaaa1111bbbb2222cccc"
data.object.public_idstrPublic ID of resource. Should be used to retrieve additional resource object data via OG API if necessary."zzzz9999yyyy8888xxxx
data.object.customerstrThe merchant_user_id AKA the id from merchant system - not our internal public ID"h183738"
data.object.productstrThe external product ID from the merchant's system"SKUabc"
data.object.componentsarrayList of objects representing the bundle components/products[
{
"product": "product_1",
"public_id": "public_id_1"
"quantity": null
},
{
"product": "product_2",
"public_id": "public_id_2",
"quantity": 2
}
]
data.object.extra_dataobjectKey/value store for any extra information{"some": "extra", "fields": "here"}
data.object.prepaid_subscription_contextobjectPrepaid information
Returned only if prepaid is enabled
{
"prepaid_orders_remaining": 0,
"prepaid_orders_per_billing": 3,
"renewal_behavior": "autorenew",
"last_renewal_revenue": 100.8,
"prepaid_origin_merchant_order_id": "#3082"
} | null
data.object.quantityintNumber of items1
data.object.pricestrPrice of the subscription when leveraging price lock feature"12.99"
data.object.frequency_daysintOrder placement interval in days30
data.object.reminder_daysintDays before order placement to email reminder (minimum of 5)5
data.object.everyintNumber of periods1
data.object.every_periodintType of period enum

Options: 1, 2, 3
3
data.object.every_period_displaystrReadable version of period enum

Options: "Days", "Weeks", "Months"
"Months"
data.object.cancelledintUnix timestamp when the subscription was cancelled, if no longer active.1301325188
data.object.cancel_reasonstrPipe-delimited cancel reason code and cancel reason details"4|Overstocked"
data.object.cancel_reason_codeintCode ID of the cancel reason4
data.object.session_idstrSession ID, obtained from og_session_id cookie"aaaa1111bbbb2222cccc.450125.1299622365"
data.object.merchant_order_idstrOrder ID in your system, corresponding to the checkout that created the subscription."12345678"
data.object.liveboolDictates if the subscription is active or inactive. "Active" meaning that the customer wants to continue receiving the product at the frequency cadence; "Inactive' meaning they do not.true
data.object.external_idstrExternal representation of the subscription in your system. In the case of Shopify integrations, this is the Shopify contract ID."external-identifier"
data.object.createdintUnix timestamp when the subscription was created1300375961
data.object.start_datestrDate the subscription started.

Format: "YYYY-MM-DD"
"2021-03-25"
data.object.offerstrOffer record ID"a748aa648ac811e8af3bbc764e106cf4"
data.object.paymentstrPayment record ID"070001bc02fd11e99542bc764e1043b0"
data.object.shipping_addressstrShipping address record ID"66c25cd0564011e9abc5bc764e107990"
data.object.updatedintUnix timestamp when the subscription was updated1300375961
data.object.one_click_tokenstr1-Click action token

Only passed on subscription.create, subscription.cancel, and subscription.refresh_one_click_token events
"eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudCI6IjAxZm"
data.context.sourcestrDictates where the event came from. Regular checkout subscription will have the value "PurchasePOST", but if it got created during program import its value will be "XML IMPORT""XML IMPORT"
  • Example data:
{
  "id": "mmmm4444nnnn3333pppp",
  "type": "subscription.create",
  "created": 1622589211,
  "data": {
    "object": {
      "type": "subscription",
      "merchant": "aaaa1111bbbb2222cccc",
      "public_id": "zzzz9999yyyy8888xxxx",
      "customer": "m1234576",
      "product": "SKUabc",
      "components": [  
        {
          "product": "product_1",  
          "public_id": "public_id_1",  
          "quantity": null  
        },  
        {  
          "product": "product_2",  
          "public_id": "public_id_2",  
          "quantity": 2  
        }  
			],
      "extra_data": {},
      "quantity": 1,
      "price": null,
      "frequency_days": 56,
      "reminder_days": 10,
      "every": 2,
      "every_period": 2,
      "every_period_display": "Weeks",
      "cancelled": 1301325188,
      "cancel_reason": "",
      "cancel_reason_code": null,
      "session_id": "aaaa1111bbbb2222cccc.450125.1299622365",
      "merchant_order_id": "12345678",
      "live": true,
      "external_id": null,
      "created": 1300375961,
      "start_date": "2021-03-25",
      "offer": "a748aa648ac811e8af3bbc764e106cf4",
      "payment": "070001bc02fd11e99542bc764e1043b0",
      "shipping_address": "66c25cd0564011e9abc5bc764e107990",
      "updated": 1300375961,
      "one_click_token": "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJtZXJjaGFudCI6IjAxZm",
      "prepaid_subscription_context": {  
        "prepaid_orders_remaining": 0,  
        "prepaid_orders_per_billing": 3,  
        "renewal_behavior": "autorenew",  
        "last_renewal_revenue": 100.8,  
        "prepaid_origin_merchant_order_id": "#3082"  
      }
    },
   "context":{
      "source":"PurchasePOST"
    }
  }
}

Subscription Event Types

  • subscription.create

  • Triggered whenever the customer creates a subscription. This event can only be triggered once for a subscription.
  • subscription.cancel

  • Triggered whenever a subscription is cancelled. This event can be triggered more than once for a subscription.
  • subscription.sku_swap

  • Triggered when the product associated with a subscription is changed. This event can be triggered more than once for a subscription.
  • subscription.change_live

  • Triggered when a cancelled subscription is reactivated. This event can be triggered more than once for a subscription.
  • subscription.change_frequency

  • Triggered when the subscription's delivery frequency is modified. This event can be triggered more than once for a subscription.
  • subscription.change_components

  • For subscriptions associated with bundles, this is triggered when a product is updated, added, or removed from the list of bundle components of the subscription. This event can be triggered more than once for a subscription.
  • subscription.change_quantity

  • Triggered when the subscription's quantity is modified. This event can be triggered more than once for a subscription.
  • subscription.change_shipping_address

  • Triggered when a subscription's shipping address is set. This event can be triggered more than once for a subscription.
  • subscription.change_payment

  • Triggered when a subscription's payment is set. This event can be triggered more than once for a subscription.
  • subscription.refresh_one_click_token

  • Triggered when the previous 1-Click token is used.