Comgate Payments API Typescript SDK written in Typescript.
Implemented API Methods:
- create
- cancel
- recurring
- refund
- capturePreauth
- cancelPreauth
- methods
- status
See official Comgate REST API Documentation.
Node 18 or higher.
Install the package with:
npm install comgate-node
# or
yarn add comgate-node
import ComgateClient from "comgate-client"
const comgateClient = new ComgateClient({
merchant: 12345,
secret: "abcdefgh",
test: true
})
import {
CreateCountry,
CreateCurr,
CreateLanguage
} from "comgate-node/types/endpoints/create";
async function create(
country: CreateCountry,
price: number,
curr: CreateCurr,
label: string,
refId: string,
method: string,
email: string,
lang: CreateLanguage,
prepareOnly: boolean
) {
try {
const response = await comgateClient.create({
country: country,
price: price,
curr: curr,
label: label,
refId: refId,
method: method,
email: email,
lang: lang,
prepareOnly: prepareOnly
})
console.log('Payment create response:', response);
} catch (error) {
console.error('Error create payment:', error);
}
}
More examples can be found in tests/ folder.
Test files are located in tests/ folder.
ts-node tests/create.ts "CZ" 10000 "CZK" "Order from eshop" "1244" "ALL" "test@test.com" "cs" true
ts-node tests/cancel.ts "ABC-0123-1ABC"
# test not implemented
ts-node ts-node tests/refund.ts "ABC-0123-1ABC" "1000" "CZK"
# test not implemented
# test not implemented
ts-node tests/methods.ts "json" "cs" "CZK" "CZ"
ts-node tests/status.ts "ABC-0123-1ABC"
If you find a bug, please submit the issue in Github directly.