Announcements
Why Use SCAPI
Base URL and Request Formation
Quick Start
Hook Method Details
Custom Properties
Remote Includes
SCAPI Specifications
B2C Commerce Release Notes
Ask the Community
This document lists available SCAPI hooks with method details.
For SLAS hook details, see SLAS Support for Custom Parameters and Hooks.
For custom property type details, see Custom Properties.
Authentication hooks for the Shopper API, called by the /login endpoint.
dw.ocapi.shop.auth.afterPOST
POST /customers/auth
afterPOST (customer : dw.customer.Customer, authRequestType : dw.value.EnumValue) : dw.system.Status
The function is called after the customer has been authenticated.
dw.ocapi.shop.auth.beforePOST
POST /customers/auth
beforePOST (authorizationHeader : String, authRequestType : dw.value.EnumValue) : dw.system.Status
The function is called before the customer has been authenticated.
dw.ocapi.shop.auth.modifyPOSTResponse
POST /customers/auth
modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer, authRequestType : dw.value.EnumValue) : dw.system.Status
Basket hooks for the Shopper API.
dw.ocapi.baskets.actions.afterMerge
POST /baskets/actions/merge
afterMerge (destinationBasket : dw.order.Basket) : dw.system.Status
The function is called after the basket is merged.
dw.ocapi.baskets.actions.afterTransfer
POST /baskets/actions/transfer
afterTransfer (transferredBasket : dw.order.Basket) : dw.system.Status
The function is called after the basket is transferred.
dw.ocapi.shop.basket.afterDELETE
DELETE /baskets/{basket_id}
afterDELETE (basketId : String) : dw.system.Status
The function is called after removing a basket.
dw.ocapi.shop.basket.afterPATCH
PATCH /baskets/{basket_id}
afterPATCH (basket : dw.order.Basket, basketInput : Basket) : dw.system.Status
The function is called after updating of the basket.
dw.ocapi.shop.basket.afterPOST
POST /baskets
afterPOST (basket : dw.order.Basket) : dw.system.Status
The function is called after the basket was created.
dw.ocapi.shop.basket.beforeDELETE
DELETE /baskets/{basket_id}
beforeDELETE (basket : dw.order.Basket) : dw.system.Status
The function is called before removing a basket.
dw.ocapi.shop.basket.beforeGET
GET /baskets/{basket_id}
beforeGET (basketId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.basket.beforePATCH
PATCH /baskets/{basket_id}
beforePATCH (basket : dw.order.Basket, basketInput : Basket) : dw.system.Status
The function is called before updating of the basket.
dw.ocapi.shop.basket.beforePOST_v2
POST /baskets
beforePOST_v2 (basketRequest : Basket) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.basket.billing_address.afterPUT
PUT /baskets/{basket_id}/billing_address
afterPUT (basket : dw.order.Basket, billingAddress : OrderAddress) : dw.system.Status
The function is called after setting of the billing address to the basket.
dw.ocapi.shop.basket.billing_address.beforePUT
PUT /baskets/{basket_id}/billing_address
beforePUT (basket : dw.order.Basket, billingAddress : OrderAddress) : dw.system.Status
The function is called before setting of the billing address to the basket.
dw.ocapi.shop.basket.billing_address.modifyPUTResponse
PUT /baskets/{basket_id}/billing_address
modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, addressRequest : OrderAddress) : dw.system.Status
dw.ocapi.shop.basket.coupon.afterDELETE
DELETE /baskets/{basket_id}/coupons/{coupon_item_id}
afterDELETE (basket : dw.order.Basket, couponItemID : String) : dw.system.Status
The function is called after removing a coupon from a basket.
dw.ocapi.shop.basket.coupon.afterPOST
POST /baskets/{basket_id}/coupons
afterPOST (basket : dw.order.Basket, couponItem : Basket, addressRequest : CouponItem) : dw.system.Status
The function is called after adding a coupon to a basket.
dw.ocapi.shop.basket.coupon.beforeDELETE
DELETE /baskets/{basket_id}/coupons/{coupon_item_id}
beforeDELETE (basket : dw.order.Basket, couponItemID : String) : dw.system.Status
The function is called before removing a coupon from a basket.
dw.ocapi.shop.basket.coupon.beforePOST
POST /baskets/{basket_id}/coupons
beforePOST (basket : dw.order.Basket, couponItem : Basket, addressRequest : CouponItem) : dw.system.Status
The function is called before adding a coupon to a basket.
dw.ocapi.shop.basket.coupon.modifyDELETEResponse
DELETE /baskets/{basket_id}/coupons/{coupon_item_id}
modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, couponItemId : String) : dw.system.Status
dw.ocapi.shop.basket.coupon.modifyPOSTResponse
POST /baskets/{basket_id}/coupons
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, couponRequest : Basket, addressRequest : CouponItem) : dw.system.Status
dw.ocapi.shop.basket.customer.afterPUT
PUT /baskets/{basket_id}/customer
afterPUT (basket : dw.order.Basket, customerInfo : CustomerInfo) : dw.system.Status
The function is called after setting of customer information for the basket.
dw.ocapi.shop.basket.customer.beforePUT
PUT /baskets/{basket_id}/customer
beforePUT (basket : dw.order.Basket, customerInfo : CustomerInfo) : dw.system.Status
The function is called before setting of customer information for the basket.
dw.ocapi.shop.basket.customer.modifyPUTResponse
PUT /baskets/{basket_id}/customer
modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, customerRequest : CustomerInfo) : dw.system.Status
dw.ocapi.shop.basket.gift_certificate_item.afterDELETE
DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
afterDELETE (basket : dw.order.Basket, giftCertificateItemId : String) : dw.system.Status
The function is called after deleting a gift certificate item from a basket.
dw.ocapi.shop.basket.gift_certificate_item.afterPATCH
PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
afterPATCH (basket : dw.order.Basket, giftCertificateItemId : String, item : GiftCertificateItem) : dw.system.Status
The function is called after updating a gift certificate item of a basket.
dw.ocapi.shop.basket.gift_certificate_item.afterPOST
POST /baskets/{basket_id}/gift_certificate_items
afterPOST (basket : dw.order.Basket, item : GiftCertificateItem) : dw.system.Status
The function is called after adding a gift certificate item to a basket.
dw.ocapi.shop.basket.gift_certificate_item.beforeDELETE
DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
beforeDELETE (basket : dw.order.Basket, giftCertificateItemId : String) : dw.system.Status
The function is called before deleting a gift certificate item from a basket.
dw.ocapi.shop.basket.gift_certificate_item.beforePATCH
PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
beforePATCH (basket : dw.order.Basket, giftCertificateItemId : String, item : GiftCertificateItem) : dw.system.Status
The function is called before updating a gift certificate item of a basket.
dw.ocapi.shop.basket.gift_certificate_item.beforePOST
POST /baskets/{basket_id}/gift_certificate_items
beforePOST (basket : dw.order.Basket, item : GiftCertificateItem) : dw.system.Status
The function is called before adding a gift certificate item to a basket.
dw.ocapi.shop.basket.gift_certificate_item.modifyDELETEResponse
DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, giftCertificateItemId : String) : dw.system.Status
dw.ocapi.shop.basket.gift_certificate_item.modifyPATCHResponse
PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}
modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, giftCertificateItemId : String) : dw.system.Status
dw.ocapi.shop.basket.gift_certificate_item.modifyPOSTResponse
POST /baskets/{basket_id}/gift_certificate_items
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, certificateItemRequest : GiftCertificateItem) : dw.system.Status
dw.ocapi.shop.basket.item.afterDELETE
DELETE /baskets/{basket_id}/items/{item_id}
afterDELETE (basket : dw.order.Basket, productItemId : String) : dw.system.Status
The function is called after a basket item is removed.
dw.ocapi.shop.basket.item.afterPATCH
PATCH /baskets/{basket_id}/items/{item_id}
afterPATCH (basket : dw.order.Basket, item : ProductItem) : dw.system.Status
The function is called after updating of the basket's item.
dw.ocapi.shop.basket.item.beforeDELETE
DELETE /baskets/{basket_id}/items/{item_id}
beforeDELETE (basket : dw.order.Basket, productItemId : String) : dw.system.Status
The function is called before a basket item is removed.
dw.ocapi.shop.basket.item.beforePATCH
PATCH /baskets/{basket_id}/items/{item_id}
beforePATCH (basket : dw.order.Basket, item : ProductItem) : dw.system.Status
The function is called before updating of the basket's item.
dw.ocapi.shop.basket.item.modifyDELETEResponse
DELETE /baskets/{basket_id}/items/{item_id}
modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, productItemId : String) : dw.system.Status
dw.ocapi.shop.basket.item.modifyPATCHResponse
PATCH /baskets/{basket_id}/items/{item_id}
modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, productItemId : String) : dw.system.Status
dw.ocapi.shop.basket.items.afterPOST
POST /baskets/{basket_id}/items
afterPOST (basket : dw.order.Basket, items : ProductItem) : dw.system.Status
dw.ocapi.shop.basket.items.beforePOST
POST /baskets/{basket_id}/items
beforePOST (basket : dw.order.Basket, items : ProductItem) : dw.system.Status
dw.ocapi.shop.basket.items.modifyPOSTResponse
POST /baskets/{basket_id}/items
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, productItems : ProductItem) : dw.system.Status
dw.ocapi.shop.basket.modifyGETResponse
GET /baskets/{basket_id}
modifyGETResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status
dw.ocapi.shop.basket.modifyPATCHResponse
PATCH /baskets/{basket_id}
modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status
dw.ocapi.shop.basket.modifyPOSTResponse
POST /baskets
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status
dw.ocapi.shop.basket.payment_instrument.afterDELETE
DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
afterDELETE (basket : dw.order.Basket) : dw.system.Status
It is called after the order payment instrument is removed from the basket.
dw.ocapi.shop.basket.payment_instrument.afterPATCH
PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
afterPATCH (basket : dw.order.Basket, paymentInstrument : dw.order.OrderPaymentInstrument, paymentInstrumentRequest : BasketPaymentInstrumentRequest) : dw.system.Status
The function is called after updating a payment instrument of a basket.
dw.ocapi.shop.basket.payment_instrument.afterPOST
POST /baskets/{basket_id}/payment_instruments
afterPOST (basket : dw.order.Basket, paymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status
The function is called after payment instrument adding to a basket.
dw.ocapi.shop.basket.payment_instrument.beforeDELETE
DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
beforeDELETE (basket : dw.order.Basket, delete : dw.order.OrderPaymentInstrument) : dw.system.Status
It is called before the order payment instrument is removed from the basket.
dw.ocapi.shop.basket.payment_instrument.beforePATCH
PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
beforePATCH (basket : dw.order.Basket, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status
The function is called before updating a payment instrument of a basket.
dw.ocapi.shop.basket.payment_instrument.beforePOST
POST /baskets/{basket_id}/payment_instruments
beforePOST (basket : dw.order.Basket, paymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status
The function is called before payment instrument adding to a basket.
dw.ocapi.shop.basket.payment_instrument.modifyDELETEResponse
DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentId : String) : dw.system.Status
dw.ocapi.shop.basket.payment_instrument.modifyPATCHResponse
PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentId : String) : dw.system.Status
dw.ocapi.shop.basket.payment_instrument.modifyPOSTResponse
POST /baskets/{basket_id}/payment_instruments
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentRequest : BasketPaymentInstrumentRequest) : dw.system.Status
dw.ocapi.shop.basket.payment_methods.afterGET
GET /baskets/{basket_id}/payment_methods
afterGET (basket : dw.order.Basket, paymentMethods : PaymentMethodResult) : dw.system.Status
Called before returning the list of available payment methods to the customer. Allowing modifications of the result.
dw.ocapi.shop.basket.payment_methods.beforeGET
GET /baskets/{basket_id}/payment_methods
beforeGET (basketId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.basket.payment_methods.modifyGETResponse_v2
GET /baskets/{basket_id}/payment_methods
modifyGETResponse_v2 (basket : dw.order.Basket, paymentMethodResultResponse : PaymentMethodResult) : dw.system.Status
dw.ocapi.shop.basket.shipment.afterDELETE
DELETE /baskets/{basket_id}/shipments/{shipment_id}
afterDELETE (basket : dw.order.Basket, shipmentId : String) : dw.system.Status
Called after the basket's shipment was removed.
dw.ocapi.shop.basket.shipment.afterPATCH
PATCH /baskets/{basket_id}/shipments/{shipment_id}
afterPATCH (basket : dw.order.Basket, shipment : dw.order.Shipment, shipmentInfo : Shipment) : dw.system.Status
The function is called after patching of a shipment for a basket.
dw.ocapi.shop.basket.shipment.afterPOST
POST /baskets/{basket_id}/shipments
afterPOST (basket : dw.order.Basket, shipment : Shipment) : dw.system.Status
The function is called after the creation of a shipment for a basket.
dw.ocapi.shop.basket.shipment.beforeDELETE
DELETE /baskets/{basket_id}/shipments/{shipment_id}
beforeDELETE (basket : dw.order.Basket, shipment : dw.order.Shipment) : dw.system.Status
Called before the basket's shipment is removed.
dw.ocapi.shop.basket.shipment.beforePATCH
PATCH /baskets/{basket_id}/shipments/{shipment_id}
beforePATCH (basket : dw.order.Basket, shipment : dw.order.Shipment, shipmentInfo : Shipment) : dw.system.Status
The function is called before changing of a shipment for a basket.
dw.ocapi.shop.basket.shipment.beforePOST
POST /baskets/{basket_id}/shipments
beforePOST (basket : dw.order.Basket, shipment : Shipment) : dw.system.Status
The function is called before the creation of a shipment for a basket.
dw.ocapi.shop.basket.shipment.modifyDELETEResponse
DELETE /baskets/{basket_id}/shipments/{shipment_id}
modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentId : String) : dw.system.Status
dw.ocapi.shop.basket.shipment.modifyPATCHResponse
PATCH /baskets/{basket_id}/shipments/{shipment_id}
modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentId : String) : dw.system.Status
dw.ocapi.shop.basket.shipment.modifyPOSTResponse
POST /baskets/{basket_id}/shipments
modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentRequest : Shipment) : dw.system.Status
dw.ocapi.shop.basket.shipment.shipping_address.afterPUT
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address
afterPUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingAddress : OrderAddress) : dw.system.Status
The function is called after setting of the shipping address to a certain shipment of the basket.
dw.ocapi.shop.basket.shipment.shipping_address.beforePUT
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address
beforePUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingAddress : OrderAddress) : dw.system.Status
The function is called before setting of the shipping address to a certain shipment of the basket.
dw.ocapi.shop.basket.shipment.shipping_address.modifyPUTResponse
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address
modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, orderAddressRequest : OrderAddress) : dw.system.Status
dw.ocapi.shop.basket.shipment.shipping_method.afterPUT
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method
afterPUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingMethod : ShippingMethod) : dw.system.Status
The function is called after setting of the shipping method to a certain shipment of the basket.
dw.ocapi.shop.basket.shipment.shipping_method.beforePUT
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method
beforePUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingMethod : ShippingMethod) : dw.system.Status
The function is called before setting of the shipping method to a certain shipment of the basket.
dw.ocapi.shop.basket.shipment.shipping_method.modifyPUTResponse
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method
modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, shippingMethodRequest : ShippingMethod) : dw.system.Status
dw.ocapi.shop.basket.shipments.shipping_methods.beforeGET
GET /baskets/{basket_id}/shipments/{shipment_id}/shipping_methods
beforeGET (basketId : String, shipmentId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.basket.shipments.shipping_methods.modifyGETResponse_v2
GET /baskets/{basket_id}/shipments/{shipment_id}/shipping_methods
modifyGETResponse_v2 (shipment : dw.order.Shipment, shippingMethodResult : ShippingMethodResult) : dw.system.Status
dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/coupons/{coupon_item_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/items/{item_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/notes/{note_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/price_adjustments/{price_adjustment_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
DELETE /baskets/{basket_id}/shipments/{shipment_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
GET /baskets/{basket_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PATCH /baskets/{basket_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PATCH /baskets/{basket_id}/items/{item_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PATCH /baskets/{basket_id}/shipments/{shipment_id}
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/coupons
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/gift_certificate_items
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/items
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/notes
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/payment_instruments
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/price_adjustments
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /baskets/{basket_id}/shipments
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
POST /orders
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PUT /baskets/{basket_id}/billing_address
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PUT /baskets/{basket_id}/customer
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};dw.ocapi.shop.basket.validateBasket
PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method
validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status
Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.
Example showing addition, listing, and removal of flashes:
1exports.validateBasket = function(basketResponse, duringSubmit) {
2 basketResponse.addFlash({
3 type: "MyType",
4 message: "My message",
5 path: "my_path",
6 details: {
7 "k1": "v1",
8 "k2": "v2"
9 }
10 });
11 var flashToRemove;
12 for each(f in basketResponse.flashes) {
13 if (f.type == "SomeOtherType") {
14 flashToRemove = f;
15 }
16 }
17 if (flashToRemove != null) {
18 basketResponse.removeFlash(flashToRemove);
19 }
20};Category hooks for the Shopper API.
dw.ocapi.shop.category.beforeGET
GET /categories/{id}
beforeGET (categoryId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.category.modifyGETResponse
GET /categories/{id}
modifyGETResponse (scriptCategory : dw.catalog.Category, doc : Category) : dw.system.Status
The function is called after the request has been processed.
Configurations hooks for the Shopper API.
dw.shop.shopper_configuration.modifyGETResponse
GET /configurations
modifyGETResponse (configurationsResponse : object) : dw.system.Status
Customer hooks for the Shopper API.
dw.ocapi.shop.customer.afterPATCH
PATCH /customers/{customer_id}
afterPATCH (customer : dw.customer.Customer, customerInput : Customer) : dw.system.Status
The function is called after a customer was updated.
dw.ocapi.shop.customer.afterPOST
POST /customers
afterPOST (customer : dw.customer.Customer, registration : CustomerRegistration) : dw.system.Status
The function is called after a new customer registration.
dw.ocapi.shop.customer.auth.afterPOST
POST /customers/{customer_id}/auth
afterPOST (customer : dw.customer.Customer) : dw.system.Status
The function is called after the customer has been authenticated.
dw.ocapi.shop.customer.auth.beforePOST
POST /customers/{customer_id}/auth
beforePOST (customer : dw.customer.Customer) : dw.system.Status
The function is called before the customer has been authenticated.
dw.ocapi.shop.customer.auth.modifyPOSTResponse
POST /customers/{customer_id}/auth
modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status
dw.ocapi.shop.customer.baskets.beforeGET
GET /customers/{customer_id}/baskets
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.baskets.modifyGETResponse_v2
GET /customers/{customer_id}/baskets
modifyGETResponse_v2 (customer : dw.customer.Customer, customerBasketsResultResponse : BasketsResult) : dw.system.Status
dw.ocapi.shop.customer.beforeGET
GET /customers/{customer_id}
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.beforePATCH
PATCH /customers/{customer_id}
beforePATCH (customer : dw.customer.Customer, customerInput : Customer) : dw.system.Status
The function is called before a customer is updated.
dw.ocapi.shop.customer.beforePOST
POST /customers
beforePOST (registration : CustomerRegistration) : dw.system.Status
The function is called before a new customer registration.
dw.ocapi.shop.customer.modifyGETResponse
GET /customers/{customer_id}
modifyGETResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status
dw.ocapi.shop.customer.modifyPATCHResponse
PATCH /customers/{customer_id}
modifyPATCHResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status
dw.ocapi.shop.customer.modifyPOSTResponse
POST /customers
modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status
dw.ocapi.shop.customer.orders.beforeGET
GET /customers/{customer_id}/orders
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.orders.modifyGETResponse_v2
GET /customers/{customer_id}/orders
modifyGETResponse_v2 (customer : dw.customer.Customer, customerOrderResultResponse : CustomerOrderResult) : dw.system.Status
dw.ocapi.shop.customer.password.beforePUT
PUT /customers/{customer_id}/password
beforePUT (customerId : String) : dw.system.Status
The function is called before updating a customer's password.
dw.ocapi.shop.customer.password.afterPUT_v2
PUT /customers/{customer_id}/password
afterPUT_v2 (customer : dw.customer.Customer, passwordChangeRequest : PasswordChangeRequest) : dw.system.Status
The function is called to update a customer's password. The default implementation tries to change the authenticated user password to the new password provided in the request. In case of an error, the default implementation returns one of the error statuses listed in dw.customer.Credentials#setPassword(String, String, boolean). To change a password in a third-party system, use a custom implementation. Because the password is updated in this hook, not in the PUT call, if you customize this hook, your custom code must update the password. Otherwise, the password is not updated.
dw.ocapi.shop.customer.password_reset.afterPOST
POST /customers/{customer_id}/password_reset
afterPOST (customer : dw.customer.Customer, resetToken : String) : dw.system.Status
Allows resetting a customer password. See the example below sending an email with a password reset link.
1var variables: Map = new dw.util.HashMap();
2variables.put("Customer", customer);
3variables.put("ResetPasswordToken", token);
4var template: Template = new dw.util.Template("mail/resetpasswordemail.isml");
5var content: MimeEncodedText = template.render(variables);
6var mail: Mail = new Mail()
7 .setSubject("Password Reset")
8 .setContent(content)
9 .setFrom("noreply@salesforce.com")
10 .addTo(customer.profile.email);
11mail.send();dw.ocapi.shop.customer.password_reset.beforePOST
POST /customers/{customer_id}/password_reset
beforePOST (customer : dw.customer.Customer) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.payment_instrument.afterDELETE
DELETE /customers/{customer_id}/payment_instruments/{payment_instrument_id}
afterDELETE (customer : dw.customer.Customer, paymentInstrumentId : String) : dw.system.Status
The function is called after removing a payment instrument of a customer.
dw.ocapi.shop.customer.payment_instrument.afterPOST
POST /customers/{customer_id}/payment_instruments
afterPOST (customer : dw.customer.Customer, paymentInstrument : CustomerPaymentInstrumentRequest) : dw.system.Status
The function is called after a payment instrument was added to a customer.
dw.ocapi.shop.customer.payment_instrument.beforeDELETE
DELETE /customers/{customer_id}/payment_instruments/{payment_instrument_id}
beforeDELETE (customer : dw.customer.Customer, paymentInstrumentId : String) : dw.system.Status
The function is called before removing a payment instrument of a customer.
dw.ocapi.shop.customer.payment_instrument.beforeGET
GET /customers/{customer_id}/payment_instruments/{payment_instrument_id}
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.payment_instrument.beforePOST
POST /customers/{customer_id}/payment_instruments
beforePOST (customer : dw.customer.Customer, paymentInstrument : CustomerPaymentInstrumentRequest) : dw.system.Status
The function is called before a payment instrument is added to a customer.
dw.ocapi.shop.customer.payment_instrument.modifyGETResponse
GET /customers/{customer_id}/payment_instruments/{payment_instrument_id}
modifyGETResponse (customer : dw.customer.Customer, customerPaymentInstrument : dw.customer.CustomerPaymentInstrument, customerPaymentInstrumentResponse : CustomerPaymentInstrument) : dw.system.Status
dw.ocapi.shop.customer.payment_instrument.modifyPOSTResponse
POST /customers/{customer_id}/payment_instruments
modifyPOSTResponse (customer : dw.customer.Customer, customerPaymentInstrument : dw.customer.CustomerPaymentInstrument, customerPaymentInstrumentResponse : CustomerPaymentInstrument) : dw.system.Status
dw.ocapi.shop.customer.payment_instruments.beforeGET
GET /customers/{customer_id}/payment_instruments
beforeGET (customerId : String, paymentMethodId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.payment_instruments.modifyGETResponse_v2
GET /customers/{customer_id}/payment_instruments
modifyGETResponse_v2 (customer : dw.customer.Customer, customerPaymentInstrumentResultResponse : CustomerPaymentInstrumentResult) : dw.system.Status
dw.ocapi.shop.customer.product_list.afterDELETE
DELETE /customers/{customer_id}/product_lists/{list_id}
afterDELETE (customer : dw.customer.Customer, productListId : String) : dw.system.Status
The function is called after a customer product list is deleted.
dw.ocapi.shop.customer.product_list.afterPATCH
PATCH /customers/{customer_id}/product_lists/{list_id}
afterPATCH (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status
The function is called after modifying a customer product list.
dw.ocapi.shop.customer.product_list.beforeDELETE
DELETE /customers/{customer_id}/product_lists/{list_id}
beforeDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList) : dw.system.Status
The function is called before a customer product list is deleted.
dw.ocapi.shop.customer.product_list.beforeGET
GET /customers/{customer_id}/product_lists/{list_id}
beforeGET (customerId : String, productListId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.product_list.beforePATCH
PATCH /customers/{customer_id}/product_lists/{list_id}
beforePATCH (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status
The function is called before modifying a customer product list.
dw.ocapi.shop.customer.product_list.item.afterDELETE
DELETE /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
afterDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList, itemId : String) : dw.system.Status
The function is called after deleting an item from a customer product list.
dw.ocapi.shop.customer.product_list.item.afterPATCH
PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
afterPATCH (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status
The function is called after updating an item of a customer product list.
dw.ocapi.shop.customer.product_list.item.beforeDELETE
DELETE /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
beforeDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : dw.customer.ProductListItem) : dw.system.Status
The function is called before deleting an item from a customer product list.
dw.ocapi.shop.customer.product_list.item.beforeGET
GET /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
beforeGET (customerId : String, productListId : String, productListItemId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.product_list.item.beforePATCH
PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
beforePATCH (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status
The function is called before updating an item of a customer product list.
dw.ocapi.shop.customer.product_list.item.modifyGETResponse
GET /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
modifyGETResponse (customer : dw.customer.Customer, productListItem : dw.customer.ProductListItem, customerProductListItemResponse : CustomerProductListItem) : dw.system.Status
dw.ocapi.shop.customer.product_list.item.modifyPATCHResponse
PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}
modifyPATCHResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResponse : CustomerProductListItem, customerProductListItemRequest : CustomerProductListItem) : dw.system.Status
dw.ocapi.shop.customer.product_list.item.modifyPOSTResponse
POST /customers/{customer_id}/product_lists/{list_id}/items
modifyPOSTResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResponse : CustomerProductListItem, customerProductListItemRequest : CustomerProductListItem) : dw.system.Status
dw.ocapi.shop.customer.product_list.items.afterPOST
POST /customers/{customer_id}/product_lists/{list_id}/items
afterPOST (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status
The function is called after adding an item to a customer product list.
dw.ocapi.shop.customer.product_list.items.beforeGET
GET /customers/{customer_id}/product_lists/{list_id}/items
beforeGET (customerId : String, productListId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.product_list.items.beforePOST
POST /customers/{customer_id}/product_lists/{list_id}/items
beforePOST (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status
The function is called before adding an item to a customer product list.
dw.ocapi.shop.customer.product_list.items.modifyGETResponse_v2
GET /customers/{customer_id}/product_lists/{list_id}/items
modifyGETResponse_v2 (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResultResponse : CustomerProductListItemResult) : dw.system.Status
dw.ocapi.shop.customer.product_list.modifyGETResponse
GET /customers/{customer_id}/product_lists/{list_id}
modifyGETResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status
dw.ocapi.shop.customer.product_list.modifyPATCHResponse
PATCH /customers/{customer_id}/product_lists/{list_id}
modifyPATCHResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status
dw.ocapi.shop.customer.product_list.modifyPOSTResponse
POST /customers/{customer_id}/product_lists
modifyPOSTResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status
dw.ocapi.shop.customer.product_lists.afterPOST
POST /customers/{customer_id}/product_lists
afterPOST (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status
The function is called after creating a new product list for the specified customer.
dw.ocapi.shop.customer.product_lists.beforeGET
GET /customers/{customer_id}/product_lists
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.product_lists.beforePOST
POST /customers/{customer_id}/product_lists
beforePOST (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status
The function is called before creating a new product list for the specified customer.
dw.ocapi.shop.customer.product_lists.modifyGETResponse_v2
GET /customers/{customer_id}/product_lists
modifyGETResponse_v2 (customer : dw.customer.Customer, customerProductListResultResponse : CustomerProductListResult) : dw.system.Status
Customer address hooks for the Shopper API.
dw.ocapi.shop.customer.address.afterDELETE
DELETE /customers/{customer_id}/addresses/{address_name}
afterDELETE (customer : dw.customer.Customer, addressName : String) : dw.system.Status
The function is called after removing an address of a customer.
dw.ocapi.shop.customer.address.afterPATCH
PATCH /customers/{customer_id}/addresses/{address_name}
afterPATCH (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status
The function is called after updating an address of a customer.
dw.ocapi.shop.customer.address.beforeDELETE
DELETE /customers/{customer_id}/addresses/{address_name}
beforeDELETE (customer : dw.customer.Customer, addressName : String) : dw.system.Status
The function is called before removing an address of a customer.
dw.ocapi.shop.customer.address.beforeGET
GET /customers/{customer_id}/addresses/{address_name}
beforeGET (customerId : String, addressName : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.address.beforePATCH
PATCH /customers/{customer_id}/addresses/{address_name}
beforePATCH (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status
The function is called before updating an address of a customer.
dw.ocapi.shop.customer.address.modifyGETResponse
GET /customers/{customer_id}/addresses/{address_name}
modifyGETResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress) : dw.system.Status
dw.ocapi.shop.customer.address.modifyPATCHResponse
PATCH /customers/{customer_id}/addresses/{address_name}
modifyPATCHResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress, customerAddressRequest : CustomerAddress) : dw.system.Status
dw.ocapi.shop.customer.address.modifyPOSTResponse
POST /customers/{customer_id}/addresses
modifyPOSTResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress, customerAddressRequest : CustomerAddress) : dw.system.Status
The function is called before returning response.
Customer addresses hooks for the Shopper API.
dw.ocapi.shop.customer.addresses.afterPOST
POST /customers/{customer_id}/addresses
afterPOST (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status
The function is called after adding an address to a customer.
dw.ocapi.shop.customer.addresses.beforeGET
GET /customers/{customer_id}/addresses
beforeGET (customerId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.customer.addresses.beforePOST
POST /customers/{customer_id}/addresses
beforePOST (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status
The function is called before adding an address to a customer.
dw.ocapi.shop.customer.addresses.modifyGETResponse
GET /customers/{customer_id}/addresses
modifyGETResponse (customerAddressResultResponse : CustomerAddressResult) : dw.system.Status
Gift certificate hooks for version 23.1.
dw.ocapi.shop.gift_certificate.beforePOST
POST /gift_certificate
beforePOST (giftCertificateRequest : GiftCertificateRequest) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.gift_certificate.modifyPOSTResponse
POST /gift_certificate
modifyPOSTResponse (giftCertificate : dw.order.GiftCertificate, giftCertificateResponse : GiftCertificate) : dw.system.Status
Order hooks for the Shopper API.
dw.ocapi.shop.order.afterPOST
POST /orders
afterPOST (order : dw.order.Order) : dw.system.Status
The function is called after an order was created from the basket.
dw.ocapi.shop.order.beforeGET
GET /orders/{order_no}
beforeGET (orderNo : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.order.beforePOST
POST /orders
beforePOST (basket : dw.order.Basket) : dw.system.Status
The function is called before an order is created for the basket.
dw.ocapi.shop.order.modifyGETResponse
GET /orders/{order_no}
modifyGETResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status
dw.ocapi.shop.order.modifyPOSTResponse
POST /orders
modifyPOSTResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status
dw.scapi.orders.afterPOST
POST /orders
afterPOST (order : dw.order.Order) : dw.system.Status
The function is called after an order was created.
dw.scapi.orders.beforePOST
POST /orders
beforePOST (request : OrderCreateRequestWO) : dw.system.Status
The function is called before an order is created.
dw.scapi.shop.orders.lookup.afterPOST
POST /orders/{order_no}/lookup
afterPOST (order : dw.order.Order) : dw.system.Status
The function is called after looking up an order.
dw.scapi.shop.orders.lookup.beforePOST
POST /orders/{order_no}/lookup
beforePOST (request : OrderLookupRequestWO) : dw.system.Status
The function is called before looking up an order.
dw.scapi.shop.orders.lookup.modifyPOSTResponse
POST /orders/{order_no}/lookup
modifyPOSTResponse (orderLookupResponse : OrderWO) : dw.system.Status
The function is called after the post lookup order.
Order payment hooks for the Shopper API.
dw.order.payment.authorize
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
authorize (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument) : dw.system.Status
Custom payment authorization - modify the order as needed.
dw.order.payment.authorize
POST /orders/{order_no}/payment_instruments
authorize (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument) : dw.system.Status
Custom payment authorization - modify the order as needed.
dw.order.payment.authorizeCreditCard
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
authorizeCreditCard (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument, cvn : String) : dw.system.Status
Custom payment authorization of a credit card - modify the order as needed.
dw.order.payment.authorizeCreditCard
POST /orders/{order_no}/payment_instruments
authorizeCreditCard (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument, cvn : String) : dw.system.Status
Custom payment authorization of a credit card - modify the order as needed.
dw.ocapi.shop.order.validateOrder
DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}
validateOrder (order : Order) : dw.system.Status
Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:
1exports.validateBasket = function() {
2 order.addFlash({
3 type: "PaymentAuthorizationFailure",
4 message: "Order was not successfully authorized.",
5 path: "authorizations",
6 details: {
7 "result": "reject",
8 "reason": "invalid_credit_card"
9 }
10 });
11}dw.ocapi.shop.order.validateOrder
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
validateOrder (order : Order) : dw.system.Status
Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:
1exports.validateBasket = function () {
2 order.addFlash({
3 type: "PaymentAuthorizationFailure",
4 message: "Order was not successfully authorized.",
5 path: "authorizations",
6 details: {
7 result: "reject",
8 reason: "invalid_credit_card",
9 },
10 });
11};dw.ocapi.shop.order.validateOrder
POST /orders/{order_no}/payment_instruments
validateOrder (order : Order) : dw.system.Status
Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:
1exports.validateBasket = function () {
2 order.addFlash({
3 type: "PaymentAuthorizationFailure",
4 message: "Order was not successfully authorized.",
5 path: "authorizations",
6 details: {
7 result: "reject",
8 reason: "invalid_credit_card",
9 },
10 });
11};Order payment instruments hooks for the Shopper API.
dw.ocapi.shop.order.payment_instrument.afterDELETE
DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}
afterDELETE (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument) : dw.system.Status
The function is called after removing a payment instrument of an order.
dw.ocapi.shop.order.payment_instrument.afterPATCH
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
afterPATCH (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : OrderPaymentInstrumentRequest, successfullyAuthorized : boolean) : dw.system.Status
The function is called after updating a payment instrument of an order.
dw.ocapi.shop.order.payment_instrument.afterPOST
POST /orders/{order_no}/payment_instruments
afterPOST (order : dw.order.Order, paymentInstrument : OrderPaymentInstrumentRequest, successfullyAuthorized : boolean) : dw.system.Status
The function is called after a payment instrument was added to the order.
dw.ocapi.shop.order.payment_instrument.beforeDELETE
DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}
beforeDELETE (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument) : dw.system.Status
The function is called before removing a payment instrument of an order.
dw.ocapi.shop.order.payment_instrument.beforePATCH
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
beforePATCH (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : OrderPaymentInstrumentRequest) : dw.system.Status
The function is called before updating a payment instrument of an order.
dw.ocapi.shop.order.payment_instrument.beforePOST
POST /orders/{order_no}/payment_instruments
beforePOST (order : dw.order.Order, paymentInstrument : OrderPaymentInstrumentRequest) : dw.system.Status
The function is called before a payment instrument is added to the order.
dw.ocapi.shop.order.payment_instrument.modifyDELETEResponse
DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}
modifyDELETEResponse (order : dw.order.Order, orderResponse : Order, paymentInstrumentId : String) : dw.system.Status
dw.ocapi.shop.order.payment_instrument.modifyPATCHResponse
PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}
modifyPATCHResponse (order : dw.order.Order, orderResponse : Order, paymentInstrumentId : String) : dw.system.Status
dw.ocapi.shop.order.payment_instrument.modifyPOSTResponse
POST /orders/{order_no}/payment_instruments
modifyPOSTResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status
Order payment methods hooks for the Shopper API.
dw.ocapi.shop.order.payment_methods.beforeGET
GET /orders/{order_no}/payment_methods
beforeGET (orderNumber : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.order.payment_methods.modifyGETResponse_v2
GET /orders/{order_no}/payment_methods
modifyGETResponse_v2 (order : dw.order.Order, paymentMethodResultResponse : PaymentMethodResult) : dw.system.Status
Product hooks for the Shopper API.
dw.ocapi.shop.product.beforeGET
GET /products/{id}
beforeGET (productId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.product.modifyGETResponse
GET /products/{id}
modifyGETResponse (scriptProduct : dw.catalog.Product, doc : Product) : dw.system.Status
The function is called after the request has been processed.
Product search hooks for the Shopper API.
dw.ocapi.shop.product_search.beforeGET
GET /product_search
beforeGET () : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.product_search.modifyGETResponse
GET /product_search
modifyGETResponse (doc : ProductSearchResult) : dw.system.Status
The function is called after the request has been processed.
Promotion hooks for the Shopper API.
dw.ocapi.shop.promotion.beforeGET
GET /promotions/{id}
beforeGET (id : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.promotion.modifyGETResponse
GET /promotions/{id}
modifyGETResponse (scriptPromotion : dw.campaign.Promotion, doc : Promotion) : dw.system.Status
The function is called after the request has been processed.
Promotions hooks for the Shopper API.
dw.ocapi.shop.promotions.beforeGET
GET /promotions
beforeGET (campaignId : String, startDate : String, endDate : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.promotions.modifyGETResponse
GET /promotions
modifyGETResponse (doc : PromotionResult) : dw.system.Status
The function is called after the request has been processed.
Search suggestions hooks for Shop API.
dw.ocapi.shop.search_suggestion.beforeGET
GET /search_suggestion
beforeGET () : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.search_suggestion.modifyGETResponse
GET /search_suggestion
modifyGETResponse (doc : SuggestionResult) : dw.system.Status
The function is called after the request has been processed.
SEO URL Mapping hooks for the Shopper API.
dw.shop.seo.url_mapping.beforeGET
GET /url-mapping
beforeGET (urlSegment : String) : dw.system.Status
The function is called before the request will be processed.
dw.shop.seo.url_mapping.modifyGETResponse
GET /url-mapping
modifyGETResponse (urlMapping : UrlMapping) : dw.system.Status
The function is called after the request has been processed.
Shopper Context Mapping hooks for the Shopper API.
dw.shop.shopper_context.beforePUT
PUT /shopper-context
beforePUT (usid: string , siteId: string , shopperContext: ShopperContext ) : dw.system.Status
The function is called before the request will be processed.
dw.shop.shopper_context.beforePATCH
PATCH /shopper-context
beforePATCH (usid: string , siteId: string , shopperContext: ShopperContext ) : dw.system.Status
The function is called before the shopper context is updated.
dw.shop.shopper_context.modifyPATCHResponse
PATCH /shopper-context
modifyPATCHResponse dw.system.Status
The function is called after the new shopper context was updated.
Store hooks for Shop API.
dw.ocapi.shop.store.beforeGET
GET /stores/{id}
beforeGET (id : String, siteId : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.store.modifyGETResponse
GET /stores/{id}
modifyGETResponse (scriptStore : dw.catalog.Store, doc : Store) : dw.system.Status
The function is called after the request has been processed.
Stores hooks for Shop API.
dw.ocapi.shop.stores.beforeGET
GET /stores
beforeGET (latitude : Double, longitude : Double, countryCode : String, postalCode : String) : dw.system.Status
The function is called before the request will be processed.
dw.ocapi.shop.stores.modifyGETResponse
GET /stores
modifyGETResponse (doc : StoreResult) : dw.system.Status
The function is called after the request has been processed.