0.1.0 • Published 4 months ago

@tsdiapi/cardcom v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

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"
});
OptionTypeRequiredDefaultDescription
apiUrlstringāœ…""Base URL for the CardCom API
terminalIdstringāœ…""Terminal ID for authentication
apiNamestringāœ…""API username for authentication
apiPasswordstringāœ…""API password for authentication
successRedirectUrlstringāœ…""Redirect URL after successful payment
failedRedirectUrlstringāœ…""Redirect URL after failed payment
webHookUrlstringāœ…""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! šŸŽ‰

0.1.0

4 months ago

0.0.1-alpha.4

5 months ago

0.0.1-alpha.3

5 months ago

0.0.1-alpha.2

5 months ago

0.0.1-alpha.1

5 months ago