Skip to content

πŸ’³ A repository for secure and modular integration with the CLICK payment system. It provides scripts for payment preparation, redirection, and completion. This project ensures seamless transaction tracking with a simple database structure and clear API interaction.

Notifications You must be signed in to change notification settings

Iqbolshoh/php-click-payment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’³ PHP-Click-Payment πŸš€

This repository contains a simple and efficient implementation for handling payments using the Click payment system. The project is designed for seamless integration into web-based applications and includes essential files for configuration and operation. πŸŽ―πŸ’»

Payment Workflow πŸ“Š


πŸ“‚ Project Structure πŸ—οΈ

  • πŸ’° complete.php: Script to handle payment completion logic. βœ…
  • βš™οΈ config.php: Configuration file for payment information and database connection. πŸ”‘
  • πŸ—„οΈ database.sql: SQL file to set up the database structure required for the project. πŸ“Š
  • 🌐 index.php: When the user clicks the button, CLICK will redirect to the payment page. πŸ’³
  • πŸ› οΈ prepare.php: Script to handle initial payment preparation logic. ⚑

πŸ”„ Interaction Description πŸ”„

Interaction with the system is performed via the API interface on the provider’s server. The API interface must fully comply with the specifications outlined below. Payments created in the CLICK system are transmitted over HTTP (HTTPS) via POST requests. πŸŒπŸ”’

Interaction consists of two stages:

  1. Prepare πŸ—οΈ
  2. Complete βœ…

πŸ—οΈ Stage 1: Prepare (Action = 0)

πŸ”Ή Request Parameters:

# Parameter Name Data Type Description πŸ“Œ
1 click_trans_id bigint ID of the transaction in CLICK system. πŸ†”
2 service_id int ID of the service. 🎯
3 click_paydoc_id bigint Payment ID in CLICK system (Shown in SMS). πŸ“©
4 merchant_trans_id varchar Order ID/Login in the supplier’s billing system. πŸ“œ
5 amount float Payment amount (in soums) πŸ’΅
6 action int Action to perform: 0 for Prepare. βš™οΈ
7 error int Status code (0 for success, error code otherwise). ❗
8 error_note varchar Description of the status code. πŸ“„
9 sign_time varchar Payment date in format 'YYYY-MM-DD HH:mm:ss'. ⏳
10 sign_string varchar MD5 hash confirming the authenticity of the request. πŸ”’

πŸ”Έ Response Parameters:

# Parameter Name Data Type Description πŸ“Œ
1 click_trans_id bigint Payment ID in CLICK system. πŸ†”
2 merchant_trans_id varchar Order ID/Login in the supplier’s system. πŸ“œ
3 merchant_prepare_id int Payment ID in the supplier's billing system. πŸ’Ύ
4 error int Status code (0 for success, error code otherwise). ❗
5 error_note varchar Description of the status code. πŸ“„

πŸ”Ή The supplier verifies the payment options (merchant_trans_id, amount) to ensure validity and capability to provide the service or product. πŸ”βœ…


βœ… Stage 2: Complete (Action = 1)

πŸ”Ή Request Parameters:

# Parameter Name Data Type Description πŸ“Œ
1 click_trans_id bigint Payment ID in CLICK system. πŸ†”
2 service_id int ID of the service. 🎯
3 click_paydoc_id bigint Payment number in CLICK system. πŸ“©
4 merchant_trans_id varchar Order ID/Login in the supplier’s billing system. πŸ“œ
5 merchant_prepare_id int Payment ID from the "Prepare" stage. πŸ’Ύ
6 amount float Payment amount (in soums) πŸ’΅
7 action int Action to perform: 1 for Complete. βœ…
8 error int Status code (0 for success, error code otherwise). ❗
9 error_note varchar Description of the status code. πŸ“„
10 sign_time varchar Payment date in format 'YYYY-MM-DD HH:mm:ss'. ⏳
11 sign_string varchar MD5 hash confirming the authenticity of the request. πŸ”’

πŸ”Έ Response Parameters:

# Parameter Name Data Type Description πŸ“Œ
1 click_trans_id bigint Payment ID in CLICK system. πŸ†”
2 merchant_trans_id varchar Order ID/Login in the supplier’s system. πŸ“œ
3 merchant_confirm_id int Transaction ID to complete the payment. βœ…
4 error int Status code (0 for success, error code otherwise). ❗
5 error_note varchar Description of the status code. πŸ“„

πŸ“œ Database Structure πŸ—„οΈ

CREATE DATABASE IF NOT EXISTS payment;

CREATE TABLE IF NOT EXISTS payments (
    id INT AUTO_INCREMENT PRIMARY KEY,
    amount DECIMAL(10, 2) NOT NULL,
    click_trans_id VARCHAR(100) NOT NULL,
    merchant_trans_id VARCHAR(100) NOT NULL,
    status ENUM('unpay', 'paid') DEFAULT 'unpay',
    time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

πŸ”§ Basic Parameters πŸ› οΈ

<?php
// Database connection constants
define("DB_SERVER", "YOUR_DB_SERVER");
define("DB_USERNAME", "YOUR_DB_USERNAME");
define("DB_PASSWORD", "YOUR_DB_PASSWORD");
define("DB_NAME", "payment");

// Click payment integration constants
define("MERCHANT_ID", "YOUR_MERCHANT_ID");
define("SERVICE_ID", "YOUR_SERVICE_ID");
define("MERCHANT_USER_ID", "YOUR_MERCHANT_USER_ID");
define("SECRET_KEY", "YOUR_SECRET_KEY");

πŸ› οΈ Fill in your credentials to connect to the database and Click system.


πŸš€ Features πŸ†

βœ… Secure integration with Click payment πŸ”’ βœ… Simple database setup and configuration πŸ—„οΈ βœ… Modular scripts for preparation, redirection, and completion βš™οΈ


πŸ–₯ Technologies Used πŸ“Œ

PHP MySQL 🎯πŸ”₯


🀝 Contributing

🎯 Contributions are welcome! If you have suggestions or want to enhance the project, feel free to fork the repository and submit a pull request.

πŸ“¬ Connect with Me

πŸ’¬ I love meeting new people and discussing tech, business, and creative ideas. Let’s connect! You can reach me on these platforms:

About

πŸ’³ A repository for secure and modular integration with the CLICK payment system. It provides scripts for payment preparation, redirection, and completion. This project ensures seamless transaction tracking with a simple database structure and clear API interaction.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages