{"id":36981862,"url":"https://github.com/iamolayemi/laravel-paystack","last_synced_at":"2026-01-13T22:51:44.635Z","repository":{"id":44677877,"uuid":"438862802","full_name":"iamolayemi/laravel-paystack","owner":"iamolayemi","description":"Laravel Implementation of the Paystack API","archived":false,"fork":false,"pushed_at":"2025-06-28T23:58:36.000Z","size":357,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-19T09:02:21.192Z","etag":null,"topics":["laravel","paystack","paystack-api"],"latest_commit_sha":null,"homepage":"https://laravel-paystack.netlify.app","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iamolayemi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-16T04:46:39.000Z","updated_at":"2025-06-29T10:14:31.000Z","dependencies_parsed_at":"2024-05-08T04:45:00.211Z","dependency_job_id":null,"html_url":"https://github.com/iamolayemi/laravel-paystack","commit_stats":{"total_commits":6,"total_committers":2,"mean_commits":3.0,"dds":"0.16666666666666663","last_synced_commit":"bb498bb43c7f137a08699cdce48ca049a799f98f"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/iamolayemi/laravel-paystack","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamolayemi%2Flaravel-paystack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamolayemi%2Flaravel-paystack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamolayemi%2Flaravel-paystack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamolayemi%2Flaravel-paystack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iamolayemi","download_url":"https://codeload.github.com/iamolayemi/laravel-paystack/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iamolayemi%2Flaravel-paystack/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402163,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","paystack","paystack-api"],"created_at":"2026-01-13T22:51:44.499Z","updated_at":"2026-01-13T22:51:44.619Z","avatar_url":"https://github.com/iamolayemi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Paystack\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/iamolayemi/laravel-paystack.svg?style=flat-square)](https://packagist.org/packages/iamolayemi/laravel-paystack)\n[![Total Downloads](https://img.shields.io/packagist/dt/iamolayemi/laravel-paystack.svg?style=flat-square)](https://packagist.org/packages/iamolayemi/laravel-paystack)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/iamolayemi/laravel-paystack/ci.yml?branch=main)](https://github.com/iamolayemi/laravel-paystack/actions)\n[![Code Quality](https://img.shields.io/scrutinizer/g/iamolayemi/laravel-paystack.svg?style=flat-square)](https://scrutinizer-ci.com/g/iamolayemi/laravel-paystack)\n[![Code Coverage](https://img.shields.io/codecov/c/github/iamolayemi/laravel-paystack)](https://codecov.io/gh/iamolayemi/laravel-paystack)\n[![PHP Version](https://img.shields.io/packagist/php-v/iamolayemi/laravel-paystack.svg?style=flat-square)](https://php.net)\n[![License](https://img.shields.io/packagist/l/iamolayemi/laravel-paystack.svg?style=flat-square)](https://github.com/iamolayemi/laravel-paystack/blob/main/LICENSE.md)\n\nA comprehensive Laravel package for seamless integration with the Paystack payment gateway. This package provides an expressive and convenient way to interact with the Paystack API within your Laravel application.\n\n## ✨ Features\n\n- 🚀 **Fluent API Interface** - Clean and intuitive method chaining\n- 🛡️ **Comprehensive Error Handling** - Custom exception classes for different error types\n- 🔒 **Security First** - Built-in validation and security checks\n- 📊 **Full API Coverage** - Support for all Paystack API endpoints\n- 🧪 **Extensive Testing** - High test coverage with mock support\n- 📚 **Excellent Documentation** - Comprehensive guides and examples\n- 🔧 **Developer Friendly** - Easy setup and configuration\n- ⚡ **Performance Optimized** - Efficient HTTP client with retry logic\n- 🌍 **Multi-Currency Support** - NGN, GHS, USD, and more\n- 🔄 **Webhook Support** - Built-in webhook handling and verification\n\n## 📋 Requirements\n\n- **PHP**: ^8.1|^8.2|^8.3\n- **Laravel**: ^9.0|^10.0|^11.0\n- **Composer**: ^2.0\n\n## 🚀 Installation\n\nYou can install the package via Composer:\n\n```bash\ncomposer require iamolayemi/laravel-paystack\n```\n\nThe package will automatically register itself if you're using Laravel's auto-discovery feature.\n\n## ⚙️ Configuration\n\n### Environment Variables\n\nAdd your Paystack credentials to your `.env` file:\n\n```env\nPAYSTACK_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxx\nPAYSTACK_PUBLIC_KEY=pk_test_xxxxxxxxxxxxxxxxxxxxx\nPAYSTACK_CALLBACK_URL=https://yourdomain.com/paystack/callback\nPAYSTACK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxx\n```\n\n### Publishing Configuration (Optional)\n\n```bash\nphp artisan vendor:publish --provider=\"Iamolayemi\\Paystack\\PaystackServiceProvider\"\n```\n\n## 📖 Quick Start\n\n### Basic Usage\n\n```php\nuse Iamolayemi\\Paystack\\Facades\\Paystack;\n\n// Initialize a payment\n$paymentData = [\n    'amount' =\u003e 500000, // 5000 NGN in kobo\n    'email' =\u003e 'customer@example.com',\n    'reference' =\u003e 'PAY_' . uniqid(),\n    'callback_url' =\u003e 'https://yourdomain.com/payment/callback',\n];\n\n$response = Paystack::transaction()\n    -\u003einitialize($paymentData)\n    -\u003eresponse();\n\nif ($response['status']) {\n    $authorizationUrl = $response['data']['authorization_url'];\n    // Redirect user to $authorizationUrl\n}\n```\n\n### Using Helper Function\n\n```php\n// Using the helper function\n$response = paystack()-\u003etransaction()\n    -\u003einitialize($paymentData)\n    -\u003eresponse();\n```\n\n### Getting Specific Data\n\n```php\n// Get only the authorization URL\n$authorizationUrl = Paystack::transaction()\n    -\u003einitialize($paymentData)\n    -\u003eresponse('data.authorization_url');\n\n// Or use the dedicated method\n$authorizationUrl = Paystack::transaction()\n    -\u003einitialize($paymentData)\n    -\u003eauthorizationURL();\n```\n\n### Verifying Transactions\n\n```php\n// Verify a transaction\n$reference = 'PAY_xxxxxxxxx';\n$verification = Paystack::transaction()\n    -\u003everify($reference)\n    -\u003eresponse();\n\nif ($verification['status'] \u0026\u0026 $verification['data']['status'] === 'success') {\n    // Payment was successful\n    $amount = $verification['data']['amount'];\n    $customerEmail = $verification['data']['customer']['email'];\n}\n```\n\n## 🔧 Available Endpoints\n\nThe package provides access to all Paystack API endpoints:\n\n### Transactions\n```php\nPaystack::transaction()-\u003einitialize($data);\nPaystack::transaction()-\u003everify($reference);\nPaystack::transaction()-\u003elist($params);\nPaystack::transaction()-\u003efetch($id);\n```\n\n### Customers\n```php\nPaystack::customer()-\u003ecreate($data);\nPaystack::customer()-\u003elist($params);\nPaystack::customer()-\u003efetch($emailOrCode);\nPaystack::customer()-\u003eupdate($code, $data);\n```\n\n### Transfers\n```php\nPaystack::transfer()-\u003einitiate($data);\nPaystack::transfer()-\u003efinalize($data);\nPaystack::transfer()-\u003elist($params);\nPaystack::transfer()-\u003efetch($code);\n```\n\n### Plans \u0026 Subscriptions\n```php\nPaystack::plan()-\u003ecreate($data);\nPaystack::plan()-\u003elist($params);\nPaystack::subscription()-\u003ecreate($data);\nPaystack::subscription()-\u003elist($params);\n```\n\n### And Many More...\n- **Banks**: List banks, resolve account numbers\n- **Countries**: List countries and states\n- **Invoices**: Create and manage invoices\n- **Products**: Product management\n- **Refunds**: Process refunds\n- **Settlements**: Settlement management\n- **Splits**: Split payment configuration\n- **Sub-accounts**: Sub-account management\n\n## 🛡️ Error Handling\n\nThe package provides comprehensive error handling with custom exception classes:\n\n```php\nuse Iamolayemi\\Paystack\\Exceptions\\PaystackApiException;\nuse Iamolayemi\\Paystack\\Exceptions\\PaystackValidationException;\nuse Iamolayemi\\Paystack\\Exceptions\\PaystackConnectionException;\n\ntry {\n    $response = Paystack::transaction()-\u003einitialize($data)-\u003eresponse();\n} catch (PaystackValidationException $e) {\n    // Handle validation errors\n    $errors = $e-\u003egetErrors();\n} catch (PaystackApiException $e) {\n    // Handle API errors\n    $message = $e-\u003egetMessage();\n    $endpoint = $e-\u003egetEndpoint();\n} catch (PaystackConnectionException $e) {\n    // Handle connection errors\n    $url = $e-\u003egetUrl();\n}\n```\n\n## 🧪 Testing\n\n### Running Tests\n\n```bash\n# Run all tests\ncomposer test\n\n# Run with coverage\ncomposer test-coverage\n\n# Run specific test\nvendor/bin/phpunit --filter=TransactionTest\n```\n\n### Mock Testing\n\n```php\nuse Illuminate\\Support\\Facades\\Http;\n\nHttp::fake([\n    'api.paystack.co/transaction/initialize' =\u003e Http::response([\n        'status' =\u003e true,\n        'message' =\u003e 'Authorization URL created',\n        'data' =\u003e [\n            'authorization_url' =\u003e 'https://checkout.paystack.com/0x234567',\n            'reference' =\u003e 'TEST_REF_123',\n        ],\n    ], 200),\n]);\n```\n\n## 📚 Documentation\n\nFor detailed documentation, visit [https://laravel-paystack.netlify.app](https://laravel-paystack.netlify.app)\n\n### Additional Resources\n\n- [Advanced Usage Guide](docs/src/guide/advanced-usage.md)\n- [API Reference](docs/src/endpoints.md)\n- [Testing Guide](docs/src/guide/testing.md)\n- [Security Best Practices](docs/src/guide/security.md)\n\n## 🔧 Development\n\n### Prerequisites\n\n- **PHP**: ^8.1|^8.2|^8.3\n- **Composer**: ^2.0\n- **Node.js**: ^16.0 (for documentation)\n\n### Quick Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/iamolayemi/laravel-paystack.git\ncd laravel-paystack\n\n# Install dependencies\ncomposer install\n\n# Run all checks to ensure everything is working\nmake ci\n```\n\n### Available Commands\n\nThe project uses a comprehensive Makefile for development tasks:\n\n```bash\n# Show all available commands\nmake help\n\n# Install dependencies\nmake install\n\n# Development workflow\nmake dev-setup          # Complete development setup\nmake dev-install        # Install development dependencies\n```\n\n#### Testing Commands\n\n```bash\n# Run all tests\nmake test\n\n# Run tests with coverage report\nmake test-coverage\n\n# Run specific test file\nvendor/bin/phpunit tests/Unit/TransactionEndpointTest.php\n\n# Run tests with specific filter\nvendor/bin/phpunit --filter=testTransactionInitialization\n```\n\n#### Code Quality Commands\n\n```bash\n# Run static analysis with PHPStan\nmake analyse\n\n# Fix code style issues automatically\nmake fix\n\n# Check code style without fixing\nmake fix-dry-run\n\n# Run all code quality checks\nmake check\n```\n\n#### Security \u0026 Validation\n\n```bash\n# Check for security vulnerabilities\nmake security-check\n\n# Validate composer.json\nmake validate\n```\n\n#### CI/CD Commands\n\n```bash\n# Run complete CI pipeline (test + analyse + style + security)\nmake ci\n\n# Run all checks (test + analyse + style)\nmake check\n```\n\n#### Maintenance Commands\n\n```bash\n# Clean build artifacts\nmake clean\n\n# Update dependencies\nmake update\n\n# Update only composer.lock\nmake update-lock\n\n# Build the package for production\nmake build\n```\n\n#### Documentation Commands\n\n```bash\n# Generate documentation\nmake docs\n\n# Build documentation (if using docs package)\ncd docs \u0026\u0026 npm install \u0026\u0026 npm run build\n```\n\n#### Docker Commands (Optional)\n\n```bash\n# Build Docker image\nmake docker-build\n\n# Run tests in Docker\nmake docker-test\n\n# Run shell in Docker container\nmake docker-shell\n```\n\n#### Release Commands\n\n```bash\n# Release patch version (1.0.0 -\u003e 1.0.1)\nmake release-patch\n\n# Release minor version (1.0.0 -\u003e 1.1.0)\nmake release-minor\n\n# Release major version (1.0.0 -\u003e 2.0.0)\nmake release-major\n```\n\n### Development Workflow\n\n1. **Setup**: `make dev-setup`\n2. **Make changes**: Edit code\n3. **Test**: `make test`\n4. **Check quality**: `make analyse`\n5. **Fix style**: `make fix`\n6. **Full validation**: `make ci`\n7. **Commit**: `git commit -m \"Your message\"`\n8. **Push**: `git push`\n\n### Code Quality Standards\n\nThe project enforces high code quality standards:\n\n- **PHPStan Level 8**: Strict static analysis\n- **Laravel Pint**: PSR-12 coding standards\n- **PHPUnit**: 100% test coverage target\n- **Security Checker**: Vulnerability scanning\n\n### Testing Strategy\n\n```bash\n# Run all tests\nmake test\n\n# Run with coverage (generates HTML report)\nmake test-coverage\n\n# Run specific test suite\nvendor/bin/phpunit --testsuite=Unit\nvendor/bin/phpunit --testsuite=Feature\n\n# Run tests with verbose output\nvendor/bin/phpunit --verbose\n\n# Run tests with stop on failure\nvendor/bin/phpunit --stop-on-failure\n```\n\n### Static Analysis\n\n```bash\n# Run PHPStan analysis\nmake analyse\n\n# Run with specific level\nvendor/bin/phpstan analyse --level=8\n\n# Generate baseline (for ignoring existing errors)\nvendor/bin/phpstan analyse --generate-baseline\n```\n\n### Code Style\n\n```bash\n# Fix all code style issues\nmake fix\n\n# Check what would be fixed\nmake fix-dry-run\n\n# Fix specific file\nvendor/bin/pint src/Endpoints/Transaction.php\n```\n\n### Troubleshooting\n\n```bash\n# If tests fail, try cleaning and reinstalling\nmake clean\ncomposer install\nmake test\n\n# If PHPStan fails, check configuration\nvendor/bin/phpstan analyse --debug\n\n# If style check fails, auto-fix\nmake fix\n```\n\n### IDE Setup\n\nFor the best development experience:\n\n1. **PHPStorm/IntelliJ**: Enable PHPStan integration\n2. **VS Code**: Install PHP extensions\n3. **EditorConfig**: Project includes `.editorconfig`\n4. **PHP CS Fixer**: Configuration in `.php-cs-fixer.php`\n\n### Pre-commit Hooks\n\nConsider setting up pre-commit hooks:\n\n```bash\n# Create pre-commit hook\ncat \u003e .git/hooks/pre-commit \u003c\u003c 'EOF'\n#!/bin/sh\nmake ci\nEOF\n\nchmod +x .git/hooks/pre-commit\n```\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Development Setup\n\n1. Fork the repository\n2. Clone your fork\n3. Install dependencies: `composer install`\n4. Run tests: `make test`\n5. Make your changes\n6. Ensure all tests pass: `make ci`\n7. Submit a pull request\n\n## 🐛 Bug Reports\n\nIf you discover any bugs, please create an issue on [GitHub](https://github.com/iamolayemi/laravel-paystack/issues).\n\n## 🔒 Security\n\nIf you discover any security-related issues, please email [olatayo.olayemi.peter@gmail.com](mailto:olatayo.olayemi.peter@gmail.com) instead of using the issue tracker.\n\n## 📄 License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n## 🙏 Credits\n\n- [Olayemi Olatayo](https://github.com/iamolayemi) - Original author\n- [All Contributors](../../contributors) - Community contributors\n- [Paystack](https://paystack.com) - Payment gateway provider\n\n## 🔗 Links\n\n- [Paystack API Documentation](https://paystack.com/docs)\n- [Laravel Documentation](https://laravel.com/docs)\n- [Package on Packagist](https://packagist.org/packages/iamolayemi/laravel-paystack)\n- [GitHub Repository](https://github.com/iamolayemi/laravel-paystack)\n\n## 📊 Statistics\n\n- **Downloads**: [![Total Downloads](https://img.shields.io/packagist/dt/iamolayemi/laravel-paystack.svg?style=flat-square)](https://packagist.org/packages/iamolayemi/laravel-paystack)\n- **Stars**: [![GitHub stars](https://img.shields.io/github/stars/iamolayemi/laravel-paystack.svg?style=flat-square)](https://github.com/iamolayemi/laravel-paystack)\n- **Forks**: [![GitHub forks](https://img.shields.io/github/forks/iamolayemi/laravel-paystack.svg?style=flat-square)](https://github.com/iamolayemi/laravel-paystack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamolayemi%2Flaravel-paystack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiamolayemi%2Flaravel-paystack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiamolayemi%2Flaravel-paystack/lists"}