This is the early access documentation preview for Custom Views. This documentation might not be in sync with our official documentation.

commercetools Checkout Messages

commercetools Checkout sends messages to provide feedback about events.

To receive push notification messages from commercetools Checkout, use the subscribe method.

Message structure

commercetools Checkout messages are JavaScript objects with the following properties.

code
String

The message code for the event.

type
String

A string with the following pattern {level}:{entity}:{subtype} where {level} can be info, warn, or error. This field allows filtering messages from a more generic to a more specific type. Messages for different events can be of the same type.

message
String

A human-readable description of the event.

payload
Object

An object containing additional data about the event.

Example: error messagejson
{
"type": "error:init:bad_config",
"code": "project_deactivated",
"message": "commercetools Checkout {projectKey} is deactivated.",
"payload": {
"project": {
"key": "{projectKey}"
}
}
}
Example: success messagejson
{
"type": "info:order:status",
"code": "order_created",
"message": "Order {orderId} created.",
"payload": {
"order": {
"id": "{orderId}"
}
}
}

Message types

Application messages

ApplicationDeactivated

Generated when the requested application is deactivated. Activate the application in the Merchant Center to continue.

code
String
"application_disabled"
type
String

error:init:bad_config

message
String

Application {applicationKey} for commercetools Checkout {projectKey} is disabled.

payload
Object

An object containing projectKey and applicationKey.

ApplicationNotFound

Generated when the requested application is not found. The application may have been deleted or its configuration is incorrect.

code
String
"application_not_found"
type
String

error:init:bad_config

message
String

Application {applicationKey} for commercetools Checkout {projectKey} not found.

payload
Object

An object containing projectKey and applicationKey.

Cart messages

CartEmpty

Generated when the Cart for the current checkout is empty. The Cart must contain at least one Line Item.

code
String
"cart_empty"
type
String

error:cart:empty

message
String

Cart {cartId} is empty.

payload
Object

An object containing cartId.

CartEmptiedDuringCheckout

Generated when the Cart was emptied during the checkout process. It is not possible to recover from this, the customer must restart the checkout process.

code
String
"cart_emptied_during_checkout"
type
String

error:cart:empty

message
String

Cart {cartId} was emptied during checkout.

payload
Object

An object containing cartId.

CartNotFound

Generated when the Cart is not found. To start the checkout process, a valid Cart with at least one Line Item is required.

code
String
"cart_not_found"
type
String

error:cart:not_found

message
String

Cart {cartId} for commercetools Checkout {projectKey} and application {applicationKey} not found.

payload
Object

An object containing projectKey, applicationKey, and cartId.

CartWithExistingPayment

Generated when trying to add a Payment to a Cart that already references an approved Payment.

code
String
"cart_with_exisiting_payment"
type
String

error:payment:failed

message
String

Cart with existing approved payment.

payload
Object

An object containing cartId.

Checkout messages

CheckoutLoaded

Generated when Checkout has been loaded successfully and is waiting for the configuration parameters passed in the checkoutConfig object.

code
String
"checkout_loaded"
type
String

info:app:status

message
String

Checkout loaded.

payload
Object

An object containing additional data about the event.

CheckoutStarted

Generated when the configuration parameters are passed successfully through the checkoutConfig object and the checkout process starts.

code
String
"checkout_started"
type
String

info:app:status

message
String

Checkout started.

payload
Object

An object containing additional data about the event.

CheckoutCancelled

Generated when the customer cancels the checkout process.

code
String
"checkout_cancelled"
type
String

info:app:status

message
String

Checkout cancelled.

payload
Object

An object containing additional data about the event.

CheckoutCompleted

Generated when the customer completes the checkout process.

code
String
"checkout_completed"
type
String

info:app:status

message
String

Checkout for {orderId} completed.

payload
Object

An object containing orderId.

OrderCreated

Generated when an Order is created after a successful checkout process.

code
String
"order_created"
type
String

info:order:status

message
String

Order {orderId} created.

payload
Object

An object containing orderId.

OrderCreationError

Generated when an Order that references an approved Payment cannot be created.

code
String
"order_creation_error"
type
String

error:order:failed

message
String

Order creation failed with approved payment.

payload
Object

An object containing cartId and errors.

Configuration messages

InitTimeout

Generated when Checkout has not received the configuration parameters passed through the checkoutConfig object on time.

code
String
"init_timeout"
type
String

error:init:timeout

message
String

Timeout error, no init message received.

payload
Object

An object containing additional data about the event.

BadInputData

Generated when the checkoutConfig object contains one or more invalid fields.

code
String
"invalid_fields"
type
String

error:init:bad_config

message
String

Some fields are invalid.

payload
Object

An object containing an array of field, message, and invalidValue.

InvalidToken

Generated when the accessToken is invalid.

code
String
"invalid_token"
type
String

error:token:invalid

message
String

The token is invalid.

payload
Object

An object containing additional data about the event.

NoShippingMethods

Generated when no Shipping Method is available for the shipping address of the Cart. This may indicate an incomplete configuration.

code
String
"no_shipping_methods"
type
String

warn:init:bad_config

message
String

There are no shipping methods matching cart.

payload
Object

An object containing cartId.

NoPaymentMethods

Generated when no payment method is set up for an application. Add at least one Payment method to the application in the Merchant Center.

code
String
"no_payment_methods"
type
String

error:init:bad_config

message
String

There are no payment methods configured.

payload
Object

An object containing additional data about the event.

UnallowedOrigin

Generated when Checkout cannot be initialized because the URL that is trying to initialize it is not in the list of the allowed URLs for the application. Add the URL to the Origin URLs list in your application settings in the Merchant Center.

code
String
"unallowed_origin"
type
String

error:init:bad_config

message
String

Unallowed origin {origin}, allowed origins {allowedOrigins}.

payload
Object

An object containing origin and allowedOrigins.

UnavailableLocale

Generated when the provided locale is not available for localization. The localization falls back to English.

code
String
"unavailable_locale"
type
String

error:init:bad_config

message
String

The provided locale {locale} is not available for translated definitions.

payload
Object

An object containing locale.

DeprecatedFields

Generated when the checkoutConfig object contains one or more deprecated fields.

code
String
"deprecated_fields"
type
String

warn:init:bad_config

message
String

Some fields are deprecated.

payload
Object

An object containing an array of field and message.

Payment Service Provider messages

AdyenInitError

Generated when the Adyen payment connector cannot be initialized.

code
String
"adyen_init_error"
type
String

error:psp:bad_config

message
String

Could not initialise Adyen.

payload
Object

An object containing psp, clientKey, and enviroment.

AdyenBadConfig

Generated when the configuration to initialize the Adyen payment connector contains at least one invalid field.

code
String
"adyen_bad_config"
type
String

error:psp:bad_config

message
String

Some fields are invalid.

payload
Object

An object containing psp and an array of objects with the invalid fields.

AdyenTimeout

Generated when a timeout error occurs while initializing the Adyen payment connector.

code
String
"adyen_timeout"
type
String

error:psp:bad_config

message
String

Timeout while initialising Adyen.

payload
Object

An object containing psp, clientKey, and enviroment.

Project messages

ProjectIsDeactivated

Generated when the commercetools Checkout projectKey is deactivated and cannot be initialized. Contact support via the Support Portal.

code
String
"project_deactivated"
type
String

error:init:bad_config

message
String

commercetools Checkout {projectKey} is deactivated.

payload
Object

An object containing projectKey.