
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@hudoro/central-payment
Advanced tools
Hudoro Central Payment is a package that provides centralized integration for payment systems, designed to facilitate communication with multiple payment service providers from a single point.
Instal package using pnpm
pnpm add @hudoro/central-payment
Instal package using yarn
yarn add @hudoro/central-payment
Instal package using npm
npm i @hudoro/central-payment
To start using the Midtrans integration, you need to initialize it with your Midtrans credentials:
import { transactionConfig } from 'your-package-name';
const midtransClient = transactionConfig({
apiURL: 'https://api.midtrans.com', // Use 'https://api.sandbox.midtrans.com' for testing
snapURL: 'https://app.midtrans.com', // Use 'https://app.sandbox.midtrans.com' for testing
serverKey: 'YOUR_SERVER_KEY'
});
Create a standard transaction via Midtrans Snap:
const createTransaction = async () => {
try {
const response = await midtransClient.createTransaction({
transaction_details: {
order_id: "ORDER-" + new Date().getTime(),
gross_amount: 100000
},
customer_details: {
name: "John Doe",
email: "john@example.com"
},
item_details: [
{
name: "Product Name",
price: 100000,
quantity: 1
}
],
callbacks: {
finish: "https://example.com/finish",
error: "https://example.com/error",
pending: "https://example.com/pending"
}
});
console.log("Transaction token:", response.data.token);
console.log("Redirect URL:", response.data.redirect_url);
return response.data;
} catch (error) {
console.error("Error creating transaction:", error);
}
};
Create a QRIS dynamic transaction:
const createQrisTransaction = async () => {
try {
const response = await midtransClient.createQrisMidtransTransaction({
transaction_details: {
order_id: "QRIS-" + new Date().getTime(),
gross_amount: 50000
},
customer_details: {
name: "Customer Name",
email: "customer@example.com"
}
});
console.log("QRIS String:", response.data.qr_string);
console.log("Expiry Time:", response.data.expiry_time);
return response.data;
} catch (error) {
console.error("Error creating QRIS transaction:", error);
}
};
Process a refund for a transaction:
const processRefund = async () => {
try {
const response = await midtransClient.refundTransaction({
transactionCode: "ORDER-123456789",
amount: 100000,
reason: "Customer requested refund"
});
console.log("Refund Status:", response.data.status_message);
return response.data;
} catch (error) {
console.error("Error processing refund:", error);
}
};
Process a direct online refund:
const processDirectRefund = async () => {
try {
const response = await midtransClient.directRefundTransaction({
transactionCode: "ORDER-123456789",
amount: 100000,
reason: "Customer requested refund"
});
console.log("Direct Refund Status:", response.data.status_message);
return response.data;
} catch (error) {
console.error("Error processing direct refund:", error);
}
};
Cancel a transaction:
try {
const response = await midtransClient.cancelTransaction("ORDER-123456789");
console.log("Cancel Status:", response.data.status_message);
return response.data;
} catch (error) {
console.error("Error cancelling transaction:", error);
}
};
The package includes TypeScript interfaces for all request and response objects:
ParameterTypes: Request parameters for creating transactions
MidtransResponse: Response for standard transactions
MidtransQrisDynamicResponse: Response for QRIS transactions
MidtransRefundResponse: Response for refund operations
RefundParams: Parameters for refund operations
ItemDetail: Structure for describing order items
FAQs
Backend bundling for express
We found that @hudoro/central-payment demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.