Closed atdhess closed 2 months ago
Dear @atdhess,
We appreciate your detailed communication regarding the challenges you have encountered while integrating with the NodeJS SDK.
To facilitate a comprehensive analysis and resolution, it would be indispensable to have the specific version of the SDK you are currently using. We think you might be using an older version of the SDK, or using the 'direct-sdk-nodejs', instead of the recent one, 'onlinepayments-sdk-nodejs'. This could also be the cause of the validation issues you're seeing.
We greatly value your feedback and understand the significance of having clear and accurate documentation. Rest assured, we recognize the importance of continual enhancement in this domain for the benefit of all stakeholders involved.
Thank you once again for your cooperation and patience as we work towards resolving this issue.
Kind regards, Worldline Online Payments Support Team
Hi,
here are the versions i use :
But i import the directSdk from "direct-sdk-nodejs", cause when i try to import directSdk from "onlinepayments-sdk-nodejs", i only have the init
and webhook
functions.
From the "direct-sdk-nodejs", i have all the needed functionnalities (hostedCheckout
, payments
, ...)
For more information here are the directSdk object log after init function:
{
directSdk: {
init: [Function: init],
webhooks: {
init: [Function: init],
validate: [Function: validate],
unmarshal: [Function: unmarshal],
inMemorySecretKeyStore: [Object]
}
}
}
{
directSdk: {
init: [Function: init],
hostedCheckout: {
createHostedCheckout: [Function: createHostedCheckout],
getHostedCheckout: [Function: getHostedCheckout]
},
hostedTokenization: {
createHostedTokenization: [Function: createHostedTokenization],
getHostedTokenization: [Function: getHostedTokenization]
},
payments: {
createPayment: [Function: createPayment],
getPayment: [Function: getPayment],
completePayment: [Function: completePayment],
cancelPayment: [Function: cancelPayment],
refundPayment: [Function: refundPayment],
capturePayment: [Function: capturePayment],
getCaptures: [Function: getCaptures],
getPaymentDetails: [Function: getPaymentDetails],
getRefunds: [Function: getRefunds]
},
payouts: {
createPayout: [Function: createPayout],
getPayout: [Function: getPayout]
},
productGroups: {
getProductGroups: [Function: getProductGroups],
getProductGroup: [Function: getProductGroup]
},
products: {
getPaymentProducts: [Function: getPaymentProducts],
getPaymentProduct: [Function: getPaymentProduct],
getProductDirectory: [Function: getProductDirectory],
getPaymentProductNetworks: [Function: getPaymentProductNetworks]
},
services: {
testConnection: [Function: testConnection],
getIINDetails: [Function: getIINDetails]
},
sessions: { createSession: [Function: createSession] },
tokens: {
createToken: [Function: createToken],
getToken: [Function: getToken],
removeToken: [Function: deleteToken]
},
context: { ... },
webhooks: {
init: [Function: init],
validate: [Function: validate],
unmarshal: [Function: unmarshal],
inMemorySecretKeyStore: [Object]
}
}
}
Hello @atdhess,
The 'direct-sdk-nodejs' is an old SDK which hasn't been maintained for a long period. The 'onlinepayments-node-js' is the one that has actual maintenance and the one that should be used in the integration. The 4.22.0 version of the onlinepayments-nodejs-sdk is correct.
The object after the init function
const onlinePaymentsSdk = require('onlinepayments-sdk-nodejs');
const paymentSdk = onlinePaymentsSdk.init({
integrator: config.integrator,
host: config.host,
scheme: 'https',
port: 443,
enableLogging: true,
apiKeyId: config.apiKey,
secretApiKey: config.apiSecret
});
console.log(paymentSdk);
should look something like this:
{
hostedCheckout: {
createHostedCheckout: [Function (anonymous)],
getHostedCheckout: [Function (anonymous)]
},
hostedTokenization: {
createHostedTokenization: [Function (anonymous)],
getHostedTokenization: [Function (anonymous)]
},
mandates: {
createMandate: [Function (anonymous)],
getMandate: [Function (anonymous)],
blockMandate: [Function (anonymous)],
unblockMandate: [Function (anonymous)],
revokeMandate: [Function (anonymous)]
},
paymentLinks: {
createPaymentLink: [Function (anonymous)],
getPaymentLinkById: [Function (anonymous)],
cancelPaymentLinkById: [Function (anonymous)]
},
payments: {
createPayment: [Function (anonymous)],
getPayment: [Function (anonymous)],
completePayment: [Function (anonymous)],
cancelPayment: [Function (anonymous)],
subsequentPayment: [Function (anonymous)],
refundPayment: [Function (anonymous)],
capturePayment: [Function (anonymous)],
getCaptures: [Function (anonymous)],
getPaymentDetails: [Function (anonymous)],
getRefunds: [Function (anonymous)]
},
payouts: {
createPayout: [Function (anonymous)],
getPayout: [Function (anonymous)]
},
productGroups: {
getProductGroups: [Function (anonymous)],
getProductGroup: [Function (anonymous)]
},
products: {
getPaymentProducts: [Function (anonymous)],
getPaymentProduct: [Function (anonymous)],
getProductDirectory: [Function (anonymous)],
getPaymentProductNetworks: [Function (anonymous)]
},
services: {
surchargeCalculation: [Function (anonymous)],
getDccRateInquiry: [Function (anonymous)],
getPrivacyPolicy: [Function (anonymous)],
testConnection: [Function (anonymous)],
getIINDetails: [Function (anonymous)]
},
sessions: { createSession: [Function (anonymous)] },
tokens: {
createToken: [Function (anonymous)],
getToken: [Function (anonymous)],
removeToken: [Function (anonymous)]
},
context: {
context: {
...
},
logger: [Function (anonymous)],
enableLogging: true,
idempotenceRequestTimestamp: null,
integrator: 'integrator',
shoppingCartExtension: null,
setContext: [Function: setContext],
getContext: [Function: getContext],
getSignature: [Function: getSignature],
setLogger: [Function: setLogger],
getLogger: [Function: getLogger],
setEnableLogging: [Function: setEnableLogging],
isLoggingEnabled: [Function: isLoggingEnabled],
setIdempotenceRequestTimestamp: [Function: setIdempotenceRequestTimestamp],
getIdempotenceRequestTimestamp: [Function: getIdempotenceRequestTimestamp],
setIntegrator: [Function: setIntegrator],
getIntegrator: [Function: getIntegrator],
setShoppingCartExtension: [Function: setShoppingCartExtension],
getShoppingCartExtension: [Function: getShoppingCartExtension]
},
webhooks: {
init: [Function: init],
validate: [Function: validate],
unmarshal: [Function: unmarshal],
inMemorySecretKeyStore: {
getSecretKey: [Function: getSecretKey],
storeSecretKey: [Function: storeSecretKey],
removeSecretKey: [Function: removeSecretKey],
clear: [Function: clear]
}
}
}
After successful initialization you can use the createHostedCheckout method to perform the request
const hostedCheckoutResponse = await paymentSdk.hostedCheckout.createHostedCheckout(config.merchantId, hostedCheckoutRequest, {});
Please let us know if this information will help you in resolving this issue. We'll take actions on our end to improve the unclarity in our documentation.
If more information is needed, please don't hesitate to reply.
Kind regards, Worldline Online Payments Support Team
Ok thanks it works !
This doc page is not really at date concerning chapter 2 : Initialise SDK
But so, thanks for the support, all is going right now.
Have a good day and keep up the good work !
Hello,
I'm looking to use via the sdk the method: initiateHostedCheckout, with this object "cardPaymentMethodSpecificInput" in my payload to set the groupCards to true :
And I get this error:
Whereas the documentation states that you can use this input. https://docs.direct.worldline-solutions.com/en/api-reference#tag/HostedCheckout/operation/CreateHostedCheckoutApi
I use this sdk:
import directSdk from 'direct-sdk-nodejs';
As explain in this documentation: https://docs.direct.worldline-solutions.com/en/integration/how-to-integrate/server-sdks/nodejs#overview_3b8452ce72bac4992ccef2e567806dceAnd i don't know why and how using this package
onlinepayments-sdk-nodejs
?