fabriciogferreira / abacatepay-php-sdk
An unofficial PHP SDK for integrating AbacatePay payment solutions into your applications.
Package info
github.com/fabriciogferreira/abacatepay-php-sdk
pkg:composer/fabriciogferreira/abacatepay-php-sdk
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- fakerphp/faker: ^1.24
- friendsofphp/php-cs-fixer: ^3.95
- pestphp/pest: ^3.8
- phpstan/phpstan: ^2.2
- vlucas/phpdotenv: ^5.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Community-maintained unofficial PHP SDK for integrating AbacatePay payment solutions.
⚠️ This is an unofficial community-maintained SDK and is not affiliated with AbacatePay.
Menu
📋 Requirements
- PHP 8.0 or higher
- Guzzle 7.0 or higher
- Composer
- Valid AbacatePay account and API credentials
- SSL enabled for production environments
💻 Installation
Install the SDK via Composer:
composer require fabriciogferreira/abacatepay-php-sdk
🔧 Configuration
First, initialize the SDK with your API token:
use AbacatePay\v2\Clients\AbacatePayClient; $abacatePayClient = new AbacatePayClient('YOUR_ABACATE_PAY_TOKEN');
⚠️ Never commit your API tokens to version control. Use environment variables instead.
📘 Usage Examples
Customer
Initialization
use AbacatePay\v2\Clients\AbacatePayClient; use AbacatePay\v2\RequestData\Customer\CustomerCreateRequestData; $abacatePayClient = new AbacatePayClient('YOUR_ABACATE_PAY_TOKEN');
Create
$customerCreateRequestData = CustomerCreateRequestData::make('fabriciof481@gmail.com') ->name('Fabrício') ->metadata([ 'herói favorito' => 'flash', 'idade' => 24 ]); $customerCreateResponseBody = $abacatePayClient->customers() ->create($customerCreateRequestData);
Returns an instance of:
AbacatePay\v2\ResponseBody\Customer\CustomerCreateResponseBody
🌟 Features
Customers
- ✅ Create customers
- ✅ Retrieve customers
- ✅ Delete customers
Subscriptions
- ✅ Create subscriptions
- ✅ Cancel subscriptions
More features will be added in future releases.
Supported Versions
| Version | Status |
|---|---|
| 2.x | Active development |
| 1.x | Maintenance only |
Changelog
See CHANGELOG.md for release history.
Versioning
This project follows Semantic Versioning (SemVer):
- MAJOR: Breaking changes
- MINOR: New backward-compatible features
- PATCH: Bug fixes
⚡ Best Practices
- Use environment variables for API tokens
- Enable error reporting in development
- Always validate customer input
- Handle exceptions appropriately
🔍 Error Handling
use AbacatePay\v2\Exceptions\AbacatePayNetworkException; use AbacatePay\v2\Exceptions\AbacatePayValidationException; use AbacatePay\v2\Exceptions\AbacatePayInvalidRequestException; use AbacatePay\v2\Exceptions\AbacatePayAuthorizationException; use AbacatePay\v2\Exceptions\AbacatePayAuthenticationException; use AbacatePay\v2\Exceptions\AbacatePayRateLimitException; use AbacatePay\v2\Exceptions\AbacatePayNotFoundException; use AbacatePay\v2\Exceptions\AbacatePayApiException; try { $customerCreateResponseBody = $abacatePayClient->customers() ->create($customerCreateRequestData); } catch (AbacatePayNetworkException $e) { // Handle network error (0) } catch (AbacatePayValidationException $e) { // Handle validation error (422) } catch (AbacatePayInvalidRequestException $e) { // Handle invalid request error(400) } catch (AbacatePayAuthorizationException $e) { // Handle authorization (403) } catch (AbacatePayAuthenticationException $e) { // Handle authentication error (401) } catch (AbacatePayRateLimitException $e) { // Handle rate limit error (429) } catch (AbacatePayNotFoundException $e) { // Handle not found error (404) } catch (AbacatePayApiException $e) { // Handle unexpected API errors (500) }
📚 Documentation
For AbacatePay API documentation and integration guides:
🤝 Contributing
We welcome contributions! Please follow the steps below.
- Fork the repository
- Create a feature branch (
feature/my-feature) - Make your changes
- Add or update tests
- Run
composer check - Open a Pull Request on GitHub
🛠️ Development
Installing packages
composer install
Running Tests
composer test # Run tests composer analyse # Run PHPStan analysis composer lint # Check code style composer fix # Fix code style composer check # Run all checks
🔒 Security
For security issues, please see our Security Policy.
❤️ Support the Project
This SDK is developed and maintained independently.
If it has been useful to you and you'd like to support its maintenance, you can contribute via PIX:
fabriciof481@gmail.com
Thank you for your support!
📄 License
This project is licensed under the MIT License.
💬 Support
- For SDK issues, open an issue
- For API questions, contact ajuda@abacatepay.com
--
Made with ❤️ by the community.