Payment Service Provider

For the Payment Service Provider (PSP) integration to work properly in Customer Service Center, Shop API interactions require code to connect Customer Service Center with the B2C Commerce PSP cartridge. To add or update a payment method after each event in Customer Service Center, “dw.order.hooks.PaymentHooks” is called within an encapsulated transaction.

To register a payment hook, complete the following registration.

    "hooks": [    
        {"name": "dw.order.payment.authorize", "script": "./authorize.js"}, 
        {"name": "dw.order.payment.authorizeCreditCard", "script": "./authorize.js"}


To initiate the authorize logic in the PSP cartridge, include the code in authorize.js.
importPackage( dw.system );
importPackage( dw.order );
importPackage( dw.value );

function authorize(order : Order, paymentDetails : OrderPaymentInstrument)
    //link your payment cartridge here..."auth for order {0}", order.orderNo);
    var gcCode : String = paymentDetails.getGiftCertificateCode();"GC Code {0}", paymentDetails.getGiftCertificateCode());
    if(gcCode == 'bad'){
        return new Status( Status.ERROR, "ERR_BAD", "The Gift Certificate {0} could not authorized successfully.", gcCode);  
    return new Status( Status.OK );  

function authorizeCreditCard(order : Order, paymentDetails : OrderPaymentInstrument, cvn : String)
    //link your payment cartridge here...
    var ccno : String = paymentDetails.getCreditCardNumber();"CC payment auth for order {0} - {1}", order.orderNo, "************" + ccno.substr(12));
    if(ccno == '4111111111112222'){
        return new Status( Status.ERROR, "ERR_2222", "Creditcard ending with {0} could not be authorized. Error code: {1}.", ccno.substr(12), "ERR_2222" );  
    return new Status( Status.OK );  

module.exports = {
    authorize : authorize,
       authorizeCreditCard : authorizeCreditCard
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.