https://github.com/adnane-ka/omnipay-tap
https://github.com/adnane-ka/omnipay-tap
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/adnane-ka/omnipay-tap
- Owner: adnane-ka
- License: mit
- Created: 2024-08-12T09:56:27.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T20:42:58.000Z (10 months ago)
- Last Synced: 2024-11-15T16:53:42.269Z (6 months ago)
- Language: PHP
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Omnipay: Tap
**Tap payments gateway for Omnipay payment processing library**
[](https://travis-ci.com/adnane-ka/omnipay-tap)
[](https://packagist.org/packages/adnane-ka/omnipay-tap)
[](https://packagist.org/packages/adnane-ka/omnipay-tap)[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment
processing library for PHP 5.3+. This package implements Tap support for Omnipay.## Installation
```shell
composer require adnane-ka/omnipay-tap
```
## Basic Usage
The following gateways are provided by this package:* Tap
This package ineteracts with [Tap's Charges API](https://developers.tap.company/reference/charges).
For general usage instructions, please see the main [Omnipay](https://github.com/thephpleague/omnipay)
repository.## Example usage
### Configuration```php
use Omnipay\Omnipay;$gateway = Omnipay::create('Tap');
/**
* You can use the testing API key provided by Tap.
* No worries on switching test & live mode since Tap provides
* Keys for both, and can distinguish between them
*
* @see https://developers.tap.company/reference/api-endpoint
* @see https://developers.tap.company/reference/testing-keys
*/
$gateway->setApiToken('sk_test_XKokBfNWv6FIYuTMg5sLPjhJ');
```
### Creating a charge
```php
$response = $gateway->purchase([
'amount' => 1, // Required
'currency' => 'KWD', // Optional, Default is USD
'customerName' => 'Test', // Optional, Default is Test
'customerEmail' => '[email protected]', // Optional, Default is Test
'sourceId' => 'src_all', // Optional, Default is src_all @see https://developers.tap.company/reference/charges#the-payment-source-object
'threeDSecure' => false, // Optional, Default is true
'returnUrl' => 'http://your_website.com/redirect_url' // Required
])
->send();if ($response->isRedirect()) {
// Data is valid and you're ready to be redirected offsite
$response->redirect();
} else {
// An error occured
// @see https://developers.tap.company/reference/charge-response-codes
echo $response->getMessage();
}
```
### Retrieving a charge
```php
$response = $gateway->completePurchase([
// tap_id is usually injected as a URL param when returned from gateway
'tap_id' => 'TYPE_IN_THE_TARGET_CHARGE_ID'
])->send();if($response->isSuccessful()){
// Payment was successful and charge was captured
// $response->getData()
// $response->getTransactionReference() // payment reference
}else{
// Charge was not captured and payment failed
// $response->getData()
}
```
## SupportIf you are having general issues with Omnipay, we suggest posting on
[Stack Overflow](http://stackoverflow.com/). Be sure to add the
[omnipay tag](http://stackoverflow.com/questions/tagged/omnipay) 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](https://groups.google.com/forum/#!forum/omnipay) which
you can subscribe to.If you believe you have found a bug, please report it using the [GitHub issue tracker](https://github.com/adnane-ka/omnipay-tap/issues),
or better yet, fork the library and submit a pull request.