anzworldline
v1.0.1
Published
ANZ Worldline SDK for Node.js.
Downloads
22
Maintainers
Readme
anzworldline
ANZ Worldline SDK for Node.js.
Install
$ npm i anzworldline --saveExample
import AnzWorldline from 'anzworldline'
const anzworldlineClient = new AnzWorldline({
merchantId: 'xxx',
apiKey: 'xxx',
apiSecret: 'xxx',
environment: 'sandbox'
})
;(async () => {
const createHostedcheckoutRes = await anzworldlineClient.execute({
method: 'POST',
url: `/v2/${anzWorldlineClient.merchantId}/hostedcheckouts`,
body: {
hostedCheckoutSpecificInput: {
returnUrl: 'xxx'
},
order: {
amountOfMoney: {
amount: 100,
currencyCode: 'AUD'
},
shipping: {
address: {
additionalInfo: 'floor 9',
city: 'Sydney',
countryCode: 'AU',
houseNumber: '3',
state: 'New South Wales',
street: 'Elizabeth St',
zip: '2000',
name: {
firstName: 'road',
surname: 'runner'
}
},
addressIndicator: 'same-as-billing',
emailAddress: '[email protected]',
type: 'overnight',
shippingCost: 0,
shippingCostTax: 0
}
},
feedbacks: {
webhooksUrls: ['xxx']
}
}
})
/*
{
RETURNMAC: 'bb446997-237d-41b5-bd35-0f742c6051e7',
hostedCheckoutId: '4458649002',
merchantReference: '66f61abdbdc348c6b9c7bd7a7a15a6aa',
redirectUrl: 'https://payment.preprod.anzworldline-solutions.com.au/hostedcheckout/PaymentMethods/Selection/0d5307eff7664859b3f6e8e283a06b8e',
partialRedirectUrl: 'preprod.anzworldline-solutions.com.au/hostedcheckout/PaymentMethods/Selection/0d5307eff7664859b3f6e8e283a06b8e'
}
*/
console.dir(createHostedcheckoutRes, { depth: 10 })
const hostedcheckout = await anzWorldlineClient.execute({
method: 'GET',
url: `/v2/${anzWorldlineClient.merchantId}/hostedcheckouts/${createHostedcheckoutRes.hostedCheckoutId}`
})
/*
{
createdPaymentOutput: {
payment: {
hostedCheckoutSpecificOutput: { hostedCheckoutId: '4458649002' },
paymentOutput: {
amountOfMoney: { amount: 100, currencyCode: 'AUD' },
references: { merchantReference: '66f61abdbdc348c6b9c7bd7a7a15a6aa' },
acquiredAmount: { amount: 100, currencyCode: 'AUD' },
customer: { device: { ipAddressCountryCode: '99' } },
cardPaymentMethodSpecificOutput: {
paymentProductId: 1,
authorisationCode: '685351',
card: {
cardNumber: '************4242',
expiryDate: '0226',
bin: '424242',
countryCode: '99'
},
fraudResults: {
fraudServiceResult: 'no-advice',
avsResult: 'X',
cvvResult: 'M'
},
schemeReferenceData: '861961576115',
paymentAccountReference: 'HJAM4FCO82VQNCX59ABSNRSVTNR2V',
threeDSecureResults: {
version: '2.2.0',
flow: 'challenge',
cavv: 'kANnMdSX47pGwDsg15UKaJeB6eJl',
eci: '5',
schemeEci: '05',
authenticationStatus: 'Y',
acsTransactionId: 'A4DCDBC9-98CB-450D-9535-3D6BED79C2A5',
dsTransactionId: 'D7B76870-0765-4F36-A9F1-C5B23D35D3E2',
xid: 'NDQ1ODY0OTAwMg==',
liability: 'issuer'
},
token: '4ad74591-0584-4751-9110-fc7760fa8bd4',
acquirerInformation: { name: 'WLAU' },
cobrandSelectionIndicator: 'alternative',
acceptance: { authorizationDate: '2026-01-24T08:51:13Z' }
},
paymentMethod: 'card',
transactionDate: '2026-01-24T07:48:43.6284794Z'
},
status: 'PENDING_CAPTURE',
statusOutput: {
isCancellable: true,
statusCategory: 'PENDING_MERCHANT',
statusCode: 5,
isAuthorized: true,
isRefundable: false
},
id: '9000004458649002000'
},
paymentStatusCategory: 'SUCCESSFUL'
},
status: 'PAYMENT_CREATED'
}
*/
console.dir(hostedcheckout, { depth: 10 })
/*
{
captureOutput: {
amountOfMoney: { amount: 100, currencyCode: 'AUD' },
references: { merchantReference: '66f61abdbdc348c6b9c7bd7a7a15a6aa' },
operationReferences: { merchantReference: '66f61abdbdc348c6b9c7bd7a7a15a6aa' },
acquiredAmount: { amount: 100, currencyCode: 'AUD' },
cardPaymentMethodSpecificOutput: {
paymentProductId: 1,
authorisationCode: '685351',
card: {
cardNumber: '************4242',
expiryDate: '0226',
bin: '424242',
countryCode: '99'
},
fraudResults: {
fraudServiceResult: 'no-advice',
avsResult: 'X',
cvvResult: 'M'
},
threeDSecureResults: { eci: '5', xid: 'NDQ1ODY0OTAwMg==' },
token: '4ad74591-0584-4751-9110-fc7760fa8bd4',
acquirerInformation: { name: 'WLAU' }
},
paymentMethod: 'card'
},
status: 'CAPTURE_REQUESTED',
statusOutput: { statusCode: 91 },
id: '9000004458649002001'
}
*/
const capturePaymentRes = await anzWorldlineClient.execute({
method: 'POST',
url: `/v2/${anzWorldlineClient.merchantId}/payments/${hostedcheckout.createdPaymentOutput.payment.id}/capture`,
body: {
isFinal: true
}
})
console.dir(capturePaymentRes, { depth: 10 })
})().catch(console.error)