https://github.com/drhdev/cppp
A simple PHP webhook to check for PayPal payments
https://github.com/drhdev/cppp
Last synced: 3 months ago
JSON representation
A simple PHP webhook to check for PayPal payments
- Host: GitHub
- URL: https://github.com/drhdev/cppp
- Owner: drhdev
- License: gpl-3.0
- Created: 2025-06-08T22:25:46.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-06-08T22:30:43.000Z (8 months ago)
- Last Synced: 2025-06-17T04:08:52.538Z (8 months ago)
- Language: PHP
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CPPP - Check PayPal Payments
A secure and robust PHP-based payment processing system that handles PayPal webhook notifications, processes payments, and sends notifications via Telegram.
## Features
- ๐ Secure PayPal webhook handling with signature verification
- ๐พ SQLite database with connection pooling for payment storage
- ๐ Comprehensive payment statistics (24h, 7d, 28d)
- ๐ฑ Telegram notifications for new payments
- โก Rate limiting to prevent abuse
- ๐ Detailed logging with automatic log rotation
- ๐งช Comprehensive test suite
## Requirements
- PHP 7.4 or higher
- Python 3.9 or higher (for testing)
- SQLite3
- PayPal Business Account
- Telegram Bot Token
## Installation
1. Clone the repository:
```bash
git clone
cd cppp
```
2. Set up the directory structure:
```bash
mkdir -p cppp_secure/database cppp_secure/logs
```
3. Configure the application:
- Copy `config.php` and update the following settings:
- PayPal webhook ID
- PayPal client ID and secret
- Telegram bot token and chat ID
- Database path
- Logging settings
4. Set proper permissions:
```bash
chmod 755 cppp
chmod 644 cppp/*.php
chmod 755 cppp_secure
chmod 755 cppp_secure/database
chmod 755 cppp_secure/logs
```
## Testing
The project includes a comprehensive test suite written in Python. To run the tests:
1. Create and activate a virtual environment:
```bash
python3 -m venv venv
source venv/bin/activate
```
2. Install required packages:
```bash
pip install requests
```
3. Run the tests:
```bash
python -m unittest test/test_cppp.py -v
```
The test suite covers:
- Configuration file structure
- Database operations
- Rate limiting
- Telegram notifications
- Log rotation
- PayPal webhook verification
## Usage
1. Set up a PayPal webhook in your PayPal Developer Dashboard:
- Event type: `PAYMENT.SALE.COMPLETED`
- URL: `https://your-domain.com/cppp/cppp.php`
2. Configure your web server (Apache/Nginx) to point to the `cppp` directory.
3. The system will automatically:
- Verify incoming PayPal webhook signatures
- Store payment information in the SQLite database
- Send notifications to your configured Telegram chat
- Maintain payment statistics
- Rotate logs when they exceed the size limit
## Configuration
The `config.php` file contains all necessary configuration options:
```php
return [
'database' => [
'path' => '/path/to/cppp_secure/database/cppp.db',
'pool_size' => 5,
'cleanup_days' => 60
],
'paypal' => [
'webhook_id' => 'YOUR_WEBHOOK_ID',
'client_id' => 'YOUR_CLIENT_ID',
'client_secret' => 'YOUR_CLIENT_SECRET'
],
'telegram' => [
'bot_token' => 'YOUR_BOT_TOKEN',
'chat_id' => 'YOUR_CHAT_ID',
'service_name' => 'My Webservice',
'message_template' => '...'
],
'logging' => [
'path' => '/path/to/cppp_secure/logs',
'filename' => 'cppp.log',
'max_size' => 5 * 1024 * 1024
],
'rate_limiting' => [
'max_requests' => 100,
'time_window' => 3600
]
];
```
## Security Considerations
- The `cppp_secure` directory should be placed outside the web root
- All sensitive configuration is stored in `config.php`
- Webhook signatures are verified for each request
- Rate limiting prevents abuse
- Logs are automatically rotated to prevent disk space issues
## License
This project is licensed under the GNU Public License - see the LICENSE file for details.