Events
  • 11 Sep 2024
  • 4 Minutes to read
  • PDF

Events

  • PDF

Article summary

Introduction

The payload of an event will consist of two parts:

  • General fields, common to all events
  • Event specific fields, nested within the data field

General payload fields

FieldTypeDescription
timeIntegerEpoch timestamp in milliseconds of the event.
typeStringType of the event. Possible values are listed below.
sourceStringSource of the event. Is equal to the Connect client schema name.
statusStringStatus of the resource associated to the event.
dataObjectData for the resource associated to the event.

Event types

  • subscription
  • product
  • order
  • coupon
  • customer

Subscription

This event is generated by Connect when there is an update on a subscription.

General fields

FieldDescription
typeThe field will contain the value 'subscription'.
statusThe status of the subscription. Possible values:
'start': The subscription is started.
'stop': The subscription is stopped.
'renew': The subscription is renewed.
'stop_reset': The subscription was stopped and starts agian.
'deliveryplan_changed:' Deliveryplan has been changed on subscription.

Event specific fields

FieldTypeDescriptionNullable
customerNumberIntegerConnect customer number related to the event.No
productCodeStringProduct code of the subscription that has started.No
periodEndIntegerEpoch timestamp in milliseconds for end of current subscription period.Yes

Example payload

{
  "time": 1610665200000,
  "type": "subscription",
  "status": "start",
  "data": {
    "customerNumber": 12345,
    "productCode": "PROD1",
    "periodEnd": 1610665200000
  }  
}

Product

This event is generated when a product is new, updated or deleted.

General fields

FieldDescription
typeThe field will contain the value 'product'.
statusThe status of the product. Possible values:
'new': The product is active.
'update': The product is updated.
'delete': The product is deleted.

Event specific fields

FieldTypeDescriptionNullable
productCodeStringProduct codeNo
companyCodeStringCompany codeYes

Example payload

{
  "time": 1610665200000,
  "type": "product",
  "status": "new",
  "data": {
    "productCode": "KUP",
    "companyCode": "468979834"
    }
  }

Coupon

This event is generated when a coupon is created, updated or deleted.

General fields

FieldDescription
typeThe field will contain the value 'coupon'.
statusThe status of the coupon. Possible values:
'new': The coupon is new.
'update': The coupon is updated.
'delete': The coupon is deleted.

Event specific fields

FieldTypeDescriptionNullable
couponCodeStringCoupon codeNo
couponNumberIntegerCoupon numberNo

Example payload

{
  "time": 1610665200000,
  "type": "coupon",
  "status": "new",
  "data": {
    "couponCode": "KUP",
    "couponNumber": 99
    }
  }

Order

This event is generated when order process is initiated or processed.

General fields

FieldDescription
typeThe field will contain the value 'order'.
statusThe status of the order. Possible values:
'verified': The verification process of an order is initiated.
'processed': The verification process of an order is processed.

Event specific fields

FieldTypeDescriptionNullable
receiversInteger arrayList of Connect customer numbers that are receivers in the order. This will be empty if payer is the same as the receiver.Yes
payerIntegerConnect customer number of the payer of the order.Yes
connectOrderNumberIntegerConnect order number.No
connectIDOrderNumberIntegerConnectID order number.Yes
statusStringStatus code for the order. See description here.Yes

Example payload

{
  "time": 1610665200000,
  "type": "order",
  "status": "verified",  
  "data": {
    "receivers": [
      23456,
      34567
    ],
    "payer": 12345,
    "connectOrderNumber": 54321,
    "connectIDOrderNumber": 24680,
    "status": "B"
  }
}

Customer

The event will be generated and sent to EventBrigde if customer data has been changed. This means the event will be trigged by a change of name, address, email address, or phone numbers.

General fields

FieldDescription
typeThe field will contain the value 'customer'.
statusThe status of the customer data. Possible values:
'data_changed': Customer data is updated.
'new': New customer is created.

Event specific fields

FieldTypeDescriptionNullable
customerNumberIntegerCustomer number.No
nameobjectObject containing name information.No
firstNameStringCustomer first name.Yes
middleNameStringCustomer middle name.Yes
lastNameStringCustomer last name.Yes
companyNameStringName of the company.Yes
departmentNameStringdepartment name.Yes
phoneNumbersobject arrayObject containing phone numbers.No
phoneNumberStringThe phone number, following the E.164 standard.Yes
phoneNumberTypeStringPhone number type: Company, Personal, FaxYes
emailsString arrayEmail addresses.No
addressStringObject containing address information.No
addressTypeStringAddress type - possible values:
'currentAddress'
'historicalAddress'
'futureAddress'
No
streetAddressStringThe street name for this address.Yes
streetNumberStringThe street number for this address.Yes
entranceStringThe entrance for this address.Yes
floorStringThe floor for this address.Yes
postalCodeStringThe postal code for this address.Yes
postalPlaceStringThe postal place for this address.Yes
postalAddressStringThe postal address for this address.Yes
countryCodeStringThe country code for this address - ISO 3166 - alpha-2.Yes

Example payload

{
  "time": 1610665200000,
  "type": "customer",
  "status": "updated",
  "data": {
    "customerNumber": 3,
    "name": {
      "firstName": "Kari",
      "middleName": "Fjordstrand",
      "lastName": "Nordmann",
      "companyName": "Mediaconnect",
      "departmentName": "Support"
     },
    "phoneNumbers": [
      {
        "phoneNumber": "+4711122333",
        "phoneNumberType": "personal"
      },
      {
        "phoneNumber": "+4711133444",
        "phoneNumberType": "company"
      }
    ],
    "emails": [
      "email1@mediaconnnect.no",
      "email2@mediaconnect.no"
    ],
    "address": {
      "addressType": "currentAddress",
      "streetAddress": "Storgt.",
      "streetNumber": 56,
      "entrance": "A",
      "floor": 2,
      "postalCode": "2016",
      "postalPlace": "Oslo",
      "postalAddress": "Pb 265 Økern",
      "countryCode": "NO"
    }
  }
}

Order status codes

The following status codes are used on Connect orders.

CodeDescription
APreliminary order (not yet confirmed by the merchant service provider).
BConfirmed order, initial status for most orders.
COrder updated in client schema.
DAn error occurred on this order.
GDuplicate order.
HWrong coupon code or number.
IError creating a name and/or address.
JError creating recurring product.
KThis order should not be processed.
LThis order needs to be processed manually.
MThis order has been processed manually.
NError due to active gift subscription.
OError due to active gift subscription, email sent.
PError when handling prepaid/single credit card.

What's Next