Download the PHP package camoo/payment-api without Composer
On this page you can find all versions of the php package camoo/payment-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package payment-api
Below is an example README.md you could include in your project. It provides an overview, installation instructions, usage examples, endpoint references, and credits. Feel free to customize this to your specific needs (e.g., project naming, author info, licensing).
Camoo Payment API – PHP Library
A simple, PSR-4 compliant PHP library for accessing the Camoo Payment API. This library provides convenient classes for working with Account and Payment endpoints, while allowing you to inject your own HTTP client if desired.
Table of Contents
- Requirements
- Installation
- Getting Started
- Configuration & Client
- Working with Account API
- Working with Payment API
- Models
- Error Handling
- Development & Contributing
- License
Requirements
- PHP 8.1+
- Composer (for dependency management)
- camoo/curl-http-client (already required in
composer.json
)
Installation
Install the package via Composer:
If you are installing from a local copy or private repository, ensure your composer.json
and repositories
settings are correctly configured, then run composer install
.
Getting Started
Configuration & Client
- Instantiate the main HTTP
Client
, providing your API key and API secret. - Optionally set
debug
totrue
if you want to see more verbose debugging info. - The API version defaults to
v1
.
Working with Account API
Use the Camoo\Payment\Api\Account
class to fetch account info (e.g. balance, etc.):
Working with Payment API
Use the Camoo\Payment\Api\Payment
class to cash out or verify a payment.
Models
This library returns response data as Model classes. Notable models include:
-
Camoo\Payment\Models\Account
- Properties:
balance
(aMoney
object) andviewedAt
(DateTimeInterface
). - Use
Account::fromArray($data)
to create from raw response data. - Use
toArray()
or JSON-encode it for debugging or storage.
- Properties:
Camoo\Payment\Models\Payment
- Holds payment data (
id
,amount
,network
,status
, timestamps, etc.). - Use
Payment::fromArray($data)
to create from raw response data. - Use
toArray()
to convert back to a standard PHP array.
- Holds payment data (
Money
Class
- Found in
Camoo\Payment\ValueObject\Money
, which pairs anamount
(float) with acurrency
(an enum fromCamoo\Payment\Enum\Currency
).
Error Handling
Most client or API errors throw a Camoo\Payment\Exception\ApiException
. This exception will include the HTTP status code (if available) and a message from the API response (or a fallback).
Example:
Development & Contributing
- Clone the repository.
-
Install dependencies:
-
Run tests (if available):
- Pull Requests: Please submit PRs that follow PSR-12 coding style and include tests.
We welcome issues and pull requests to make this library more robust, add additional endpoints, or improve performance.
License
This library is open-sourced software licensed under the MIT license.
Enjoy building with Camoo Payment API! If you have any feedback or questions, feel free to open an issue or reach out to us.