
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
swish-payment
Advanced tools
Node.js library for the Swish Handel API (Swedish mobile payment solution)
Uses promises for async operations
npm install swish-payment
swish = require('swish-payment')
Library contains only three methods:
See reference below.
Initialize Swish module.
Takes options object (see below) as argument. Resolves with options object if successful.
Must be called before adding and getting payments.
Convert provided .p12 to .pem before use (with OPENSSL or equivalent).
# OPTION OBJECT
{
cert: {
key: <STRING> # Path to .pem file containing private key
cert: <STRING> # Path to .pem file containing SSL certificate
ca: <STRING> # Path to .pem file containing root certificate
passphrase: <STRING> # Passphrase for private key
},
data: {
payeeAlias <STRING> # Merchant Swish number
currency: <STRING> # Currency code (default: "SEK")
callbackUrl: <STRING> # Callback URL for payment request status notification
}
}
Example
swish.init({
cert: {
key: 'res/certs/swish.key',
cert: 'res/certs/swish.crt',
ca: 'res/certs/swish.ca',
passphrase: 'swish'
},
data: {
payeeAlias: '1231181189',
currency: 'SEK',
callbackUrl: 'https://www.minsida.se/callback'
}
});
Send payment request to Swish.
Takes data object (see below) as argument. Resolves with Swish payment ID if successful.
# DATA OBJECT
{
payeePaymentReference: <STRING> # Merchant payment reference (e.g. order id)
payerAlias: <STRING> # Telephone number of customer
amount: <STRING> # Amount in SEK (e.g. "100" or "49.50")
message: <STRING> # Merchant supplied message to customer
}
Example
swish.add({
payeePaymentReference: "snus123",
payerAlias: '0706123456',
amount: "100",
message: "Prima snus"
})
.then(function(id) {
console.log(id); # e.g. "DE6F11C3A0AF4AFC9399C0F0ECC50C5E"
});
Get payment data by ID.
Takes Swish payment ID as argument and resolves with payment data if successful.
Example
swish.get('DE6F11C3A0AF4AFC9399C0F0ECC50C5E')
.then(function(data) {
console.log(data);
});
# Example response
{ errorCode: null,
errorMessage: null,
id: 'DE6F11C3A0AF4AFC9399C0F0ECC50C5E',
payeePaymentReference: 'snus123',
paymentReference: '5504E033FA7E4C85B7B2C9C7947D9C5D',
callbackUrl: 'https://www.test.se/callback',
payerAlias: '0706123456',
payeeAlias: '1231181189',
amount: 100,
currency: 'SEK',
message: 'Prima snus',
status: 'PAID',
dateCreated: '2016-06-03T13:20:26.093Z',
datePaid: '2016-06-03T13:20:26.094Z' }
FAQs
Node.js library for the Swish Handel API (Swedish mobile payment solution)
We found that swish-payment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.