https://github.com/contitouchtechnologies/php-contipay-libray
ContiPay PHP Client
https://github.com/contitouchtechnologies/php-contipay-libray
contipay contipay-payment-gateway zimbabwe
Last synced: 6 months ago
JSON representation
ContiPay PHP Client
- Host: GitHub
- URL: https://github.com/contitouchtechnologies/php-contipay-libray
- Owner: contitouchtechnologies
- Created: 2022-02-16T14:48:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T11:45:00.000Z (about 2 years ago)
- Last Synced: 2024-04-30T13:19:41.222Z (about 2 years ago)
- Topics: contipay, contipay-payment-gateway, zimbabwe
- Language: PHP
- Homepage: https://packagist.org/packages/nigel/contipay-php
- Size: 61.5 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ContiPay PHP Client Documentation
## Requirements
1. ContiPay Account
2. ContiPay Secret and Key
## How it Works
### 1. Install latest with Composer
```bash
composer require nigel/contipay-php
```
### 2. Require Autoload File and Classes Imports
```php
setUpProviders('InnBucks', 'IB')
->simpleDirectPayload(
$amount,
$phone,
);
$res = $contipay->setAppMode("DEV")
->setPaymentMethod()
->process($payload);
header('Content-type: application/json');
echo $res;
```
#### ii. Basic Redirect Payment Example
```php
$payload = (
new PayloadGenerator(
$merchantCode,
$webhookUrl,
$successUrl,
$cancelUrl
)
)->simpleRedirectPayload(
$amount,
$phone
);
$res = $contipay->setAppMode("DEV")
->setPaymentMethod('redirect')
->process($payload);
header('Content-type: application/json');
echo $res;
```
#### iii. Direct Payment Example
```php
$payload = (
new PayloadGenerator(
$merchantCode,
$webhookUrl
)
)->setUpCustomer('Nigel', 'Jaure', $phone, 'ZW', 'nigeljaure@gmail.com')
->setUpProviders('Ecocash', 'EC')
->setUpAccountDetails($phone, 'Nigel Jaure')
->setUpTransaction($amount, "USD")
->directPayload();
$res = $contipay
->setAppMode("DEV")
->setPaymentMethod()
->process($payload);
header('Content-type: application/json');
echo $res;
```
#### iv. Redirect Payment Example
```php
$payload = (
new PayloadGenerator(
$merchantCode,
$webhookUrl,
$successUrl,
$cancelUrl
)
)->setUpCustomer('Nigel', 'Jaure', $phone, 'ZW', 'nigeljaure@gmail.com')
->setUpTransaction($amount, "USD")
->redirectPayload();
$res = $contipay->setAppMode("DEV")
->setPaymentMethod('redirect')
->process($payload);
header('Content-type: application/json');
echo $res;;
```
### 4. Disburse Payment
```php
$privateKey = <<setUpCustomer('Nigel', 'Jaure', $phone, 'ZW', 'nigeljaure@gmail.com')
->setUpProviders('Transfer', 'TF')
->setUpAccountDetails($phone, 'Nigel Jaure')
->setUpTransaction($amount, "USD")
->directPayload();
$res = $contipay
->setAppMode("DEV")
->setPaymentMethod()
->disburse($payload, $privateKey);
header('Content-type: application/json');
echo $res;
```
## Additional Notes
- The `updateURL` method is optional and applicable only if the URL has changed. Use it to update the URLs accordingly. Here's how you can use it:
```php
$contipay = new Contipay(
'token-here', // copy from .env or paste directly
'secret-here', // copy from .env or paste directly
);
// Update URLs if necessary
$contipay->updateURL('dev-url', 'live-url');
// Process payment with the updated URLs
$res = $contipay
->setAppMode("DEV") // LIVE as another option
->setPaymentMethod()
->process($payload);
header('Content-type: application/json');
echo $res;
```
- Ensure to set the appropriate mode (`DEV` or `LIVE`) using the `setAppMode` method before processing payments.
- The provided examples cover basic scenarios, including direct and redirect payment methods, customer information setup, and transaction details.
- ContiPay JavaScript Alternative [here](https://github.com/njzw/contipay-js-client)