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. π―π»
- π° 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 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:
- Prepare ποΈ
- Complete β
# | 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. π |
# | 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. πβ
# | 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. π |
# | 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. π |
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
);
<?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.
β Secure integration with Click payment π β Simple database setup and configuration ποΈ β Modular scripts for preparation, redirection, and completion βοΈ
π― Contributions are welcome! If you have suggestions or want to enhance the project, feel free to fork the repository and submit a pull request.
π¬ I love meeting new people and discussing tech, business, and creative ideas. Letβs connect! You can reach me on these platforms: