Download the PHP package payme-quantum/payment-sdk without Composer
On this page you can find all versions of the php package payme-quantum/payment-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download payme-quantum/payment-sdk
More information about payme-quantum/payment-sdk
Files in payme-quantum/payment-sdk
Package payment-sdk
Short Description PAYME Payment Integration Library
License MIT
Informations about the package payment-sdk
PAYME Payment Integration
This project provides a PHP-based integration with the PayMe API for processing payments through multiple providers. It supports both sandbox and production environments, handles real-time payment status callbacks, and includes a fallback polling mechanism.
Features
- Seamless Environment Switching: Easily switch between sandbox and production environments via environment variables.
- Real-Time Callbacks: Supports providerCallbackHost to receive real-time payment status updates.
- Polling Mechanism: A fallback polling mechanism for cases where callback notifications fail to get the final status of transactions.
- API User and Key Management: Automatically creates API users and keys in the sandbox environment after the onboarding process completed in the admin panel.
- Unique Payment References: Generates unique payment reference IDs using uuid_v4() for each transaction.
- Unique Payment Types: Support many payment types related to the user experience:
- Simple Payment: This is when one user does one payment at a time.
- Partial Payment: This is to allow merchants to accept if a customer will do multiple payments for a specific product or service.
- Group Payment: This is when many customers are doing the same payment.
Prerequisites
PHP (>= 7.4) Composer PAYME API access (for both sandbox and production environments)
Getting Started
1. Install the package in your project
2. Environment Configuration
Create a .env file in your project root and add the following variables: text
General Configuration
Sandbox Configuration
SUBSCRIPTION_KEY_SANDBOX=
Production Configuration
SUBSCRIPTION_KEY_PRODUCTION=
3. Running the Application
To test the integration in sandbox mode, ensure that the PAYME_ENV
is set to sandbox part
in your .env
file.
php index.php
4. Payment Processing
Use the provided postPayment
and postPaymentItem
functions to initiate a payment. Here's an example of how to call them:
For Developers
Different types declaration of the system
Methods
php
getFees(amount: int, country: string): array;
Given an amount, this function allows you to get the fees associated with an operation.
php
postPayment(param: PaymentParam): array;
Initiates the transaction request. php
getPaymentStatus(reference: string): array;
Retrieves the status of the transaction request. php
postPaymentItem(param: PaymentItemParam): array;
Initiates the payment request. Don't forget that a payment is related to a specific transaction. php
getPaymentItemStatus(reference: string): array;
Retrieves the status of the payment request. php
getPaymentWithItems(reference: string): array;
Polls for the transaction status and all its related payments.
Error Handling
- In case of an error during API requests, detailed error responses are logged.
- If the callback URL fails, the fallback polling mechanism ensures that the payment status is eventually retrieved.
Roadmap
- Future Support: Plans to expand SDK functionality to support other MoMo API features beyond collections, including disbursements and transfers.
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.