@tsdiapi/cardcom v0.1.0
CardCom Plugin for TSDIAPI
A TSDIAPI plugin to integrate with CardCom payment gateway, allowing secure transactions, refunds, and tokenized payments.
š About
This TSDIAPI plugin provides a seamless way to interact with CardCom's API (v11), supporting transactions, refunds, card tokenization, and more.
š TSDIAPI CLI: @tsdiapi/cli
š CardCom API v11 Docs: CardCom API Documentation
This plugin is based on CardCom API v11, ensuring compatibility with the latest payment processing features and security standards.
š¦ Installation
Install the plugin using the TSDIAPI CLI:
tsdiapi plugins add cardcom
Install the plugin using npm:
npm install --save @tsdiapi/cardcom
Then, register the plugin in your TSDIAPI project:
import { createApp } from "@tsdiapi/server";
import createPlugin from "@tsdiapi/cardcom";
createApp({
plugins: [createPlugin()]
});
š Features
- š¹ Payment Authorization ā Securely authorize payments using tokens or card details.
- š° Charge Payments ā Capture pre-authorized payments.
- š Refund Transactions ā Partial and full refunds for transactions.
- š¦ Account Info ā Retrieve information about a CardCom account.
- š Transaction Queries ā Fetch transaction details by ID or list by date range.
- š³ Tokenized Payments ā Charge saved cards using secure tokens.
- š Low Profile Transactions ā Create and retrieve results of hosted payment pages.
- ā Seamless Integration ā Works with TSDIAPI for modular plugin-based architectures.
š§ Configuration
This plugin requires API credentials and endpoint settings, which can be configured via environment variables.
createPlugin({
apiUrl: "https://secure.cardcom.solutions/api/v11",
terminalId: "123456",
apiName: "your_api_name",
apiPassword: "your_api_password",
successRedirectUrl: "https://yourdomain.com/success",
failedRedirectUrl: "https://yourdomain.com/fail",
webHookUrl: "https://yourdomain.com/webhook"
});
Option | Type | Required | Default | Description |
---|---|---|---|---|
apiUrl | string | ā | "" | Base URL for the CardCom API |
terminalId | string | ā | "" | Terminal ID for authentication |
apiName | string | ā | "" | API username for authentication |
apiPassword | string | ā | "" | API password for authentication |
successRedirectUrl | string | ā | "" | Redirect URL after successful payment |
failedRedirectUrl | string | ā | "" | Redirect URL after failed payment |
webHookUrl | string | ā | "" | Webhook URL for payment notifications |
Alternatively, these values can be set in TSDIAPI app configuration:
this.config.apiUrl = this.config.apiUrl || appConfig["CARDCOM_API_URL"];
this.config.terminalId = this.config.terminalId || appConfig["CARDCOM_TERMINAL_ID"];
this.config.apiName = this.config.apiName || appConfig["CARDCOM_API_NAME"];
this.config.apiPassword = this.config.apiPassword || appConfig["CARDCOM_API_PASSWORD"];
this.config.successRedirectUrl = this.config.successRedirectUrl || appConfig["CARDCOM_SUCCESS_REDIRECT_URL"];
this.config.failedRedirectUrl = this.config.failedRedirectUrl || appConfig["CARDCOM_FAILED_REDIRECT_URL"];
this.config.webHookUrl = this.config.webHookUrl || appConfig["CARDCOM_WEBHOOK_URL"];
š How to Use
After installing and configuring the plugin, you can interact with CardCom API using getCardComProvider()
.
1ļøā£ Authorize a Payment
const cardcom = getCardComProvider();
const response = await cardcom.authorizePayment(100, "your_card_token", "1225");
console.log(response);
2ļøā£ Charge a Payment
const response = await cardcom.chargePayment(100, "your_card_token", "1225", "approval_number", {
name: "John Doe",
email: "john@example.com",
mobile: "+972500000000",
productDescription: "Premium Subscription"
});
console.log(response);
3ļøā£ Refund a Transaction
const response = await cardcom.refundTransaction(123456, { PartialSum: 50 });
console.log(response);
4ļøā£ List Transactions
const response = await cardcom.listTransactions("01012024", "31012024", 1, 10);
console.log(response);
5ļøā£ Get Transaction Details
const response = await cardcom.getTransactionById(987654);
console.log(response);
6ļøā£ Get Account Info
const response = await cardcom.getAccountInfoById(56789);
console.log(response);
7ļøā£ Request a New Card Token
const response = await cardcom.requestNewCard('testId');
console.log(response);
8ļøā£ Get Low Profile Transaction Result
const response = await cardcom.getLowProfileResult("low-profile-id");
console.log(response);
šØāš» Contributing
Contributions are welcome! If you have improvements or bug fixes, feel free to open a pull request.
š§ Contact: unbywyd@gmail.com
š Happy coding with TSDIAPI & CardCom! š
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago