Download the PHP package sitehandy/omnipay-toyyibpay without Composer
On this page you can find all versions of the php package sitehandy/omnipay-toyyibpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package omnipay-toyyibpay
Omnipay: toyyibPay
toyyibPay driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements toyyibPay support for Omnipay.
Requirements
- PHP 7.4 or higher
- PHP 8.0, 8.1, 8.2, 8.3, 8.4 supported
- cURL extension
- JSON extension
- Omnipay 3.x
Installation
Omnipay is installed via Composer. To install, simply require league/omnipay and sitehandy/omnipay-toyyibpay with Composer:
Note: Composer will automatically select the latest stable version. If you need a specific version, you can specify it, but using version constraints like
^1.0may cause warnings.
Version Information
- v1.0.0: First stable release with PHP 7.4-8.4 support, modern HTTP client, and comprehensive testing
- Requirements: PHP 7.4+ with cURL and JSON extensions
- Compatibility: Omnipay 3.x framework
Table of Contents
- Basic Usage
- Quick Start
- Advanced Configuration
- Error Handling
- Testing
- Security Best Practices
- Troubleshooting
- API Reference
Basic Usage
For general usage instructions, please see the main Omnipay repository.
toyyibPay Category & Bill
Each payment is a Bill, which is under a Category. To begin, you need to open an account at toyyibPay.com and then create a Category. Then, retrieve the Category Code for the gateway setup.
Quick Start
Advanced Configuration
Complete Payment with All Options
Split Payment Configuration
Custom Payment Channels
Example
How to create a Bill
Reference: https://toyyibpay.com/apireference/#cb
Bill serves as an invoice to your customer. The example below explains how you can create a toyyibPay Bill and then redirect the customer to the payment page.
How to get Bill Transactions
Reference: https://toyyibpay.com/apireference/#gbt
You may check bill payment status by submitting Bill Code and Bill Payment Status(Optional).
The code below gives an example how to retrieve the bill transactions from the payment gateway server:
Error Handling
Comprehensive Error Handling
Payment Completion Error Handling
Testing
Unit Testing Example
Integration Testing with Mock Data
Security Best Practices
1. Secure Credential Management
2. Validate Callback Data
3. Input Validation and Sanitization
Troubleshooting
Common Issues and Solutions
1. "Invalid Secret Key" Error
Problem: Getting authentication errors when creating bills.
Solutions:
- Verify your secret key is correct and active
- Check if you're using the right environment (sandbox vs production)
- Ensure the secret key matches the category code
2. Callback Not Working
Problem: Not receiving payment notifications.
Solutions:
- Ensure callback URL is publicly accessible (not localhost)
- Check server logs for incoming requests
- Verify callback URL returns HTTP 200 status
- Test callback URL manually
3. Amount Formatting Issues
Problem: Incorrect amount being charged.
Solution: toyyibPay expects amount in cents (multiply by 100).
4. SSL/TLS Issues
Problem: Connection errors when making API calls.
Solutions:
- Ensure your server supports TLS 1.2 or higher
- Update cURL and OpenSSL libraries
- Check firewall settings
Debug Mode
API Reference
Gateway Methods
purchase(array $options)
Creates a new bill for payment.
Required Parameters:
userSecretKey(string): Your toyyibPay secret keycategoryCode(string): Category code from your toyyibPay accountbillName(string): Name/title of the billbillDescription(string): Description of the paymentbillAmount(float): Amount in RM (e.g., 50.00 for RM 50)billReturnUrl(string): URL to redirect after paymentbillCallbackUrl(string): URL for payment notificationsbillExternalReferenceNo(string): Your internal reference numberbillTo(string): Customer namebillEmail(string): Customer emailbillPhone(string): Customer phone number
Optional Parameters:
billPriceSetting(int): 0=fixed amount, 1=open amountbillPayorInfo(int): 0=optional customer info, 1=requiredbillSplitPayment(int): 0=disabled, 1=enabledbillSplitPaymentArgs(string): JSON string for split payment configurationbillPaymentChannel(int): 0=all methods, 1=FPX only, 2=cards onlybillDisplayMerchant(int): 0=hide merchant info, 1=showbillContentEmail(string): Custom email contentbillChargeToCustomer(int): 1=merchant pays fees, 2=customer pays feesbillAdditionalField(array): Custom fields (will be JSON encoded)
completePurchase(array $options)
Retrieves bill transaction status.
Required Parameters:
billCode(string): Bill code returned from purchase request
Optional Parameters:
billpaymentStatus(int): Filter by payment status
Response Methods
Purchase Response
isRedirect(): Returns true if customer should be redirectedgetRedirectUrl(): Gets the payment page URLgetTransactionReference(): Gets the bill codegetMessage(): Gets error message if failed
Complete Purchase Response
isSuccessful(): Returns true if payment was successfulisRedirect(): Returns true if payment is still pendinggetTransactionId(): Gets the payment invoice numbergetTransactionReference(): Gets the bill permalinkgetMessage(): Gets status message
Payment Status Codes
1: Successful transaction2: Pending transaction3: Unsuccessful transaction4: Pending (alternative status)
Support
If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.
If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.
If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.
All versions of omnipay-toyyibpay with dependencies
omnipay/common Version ^3.0
ext-curl Version *
ext-json Version *
guzzlehttp/guzzle Version ^7.0
php-http/guzzle7-adapter Version ^1.0