adnane-ka/omnipay-tap

Tap payments gateway for Omnipay payment processing library

1.2 2024-08-12 20:32 UTC

This package is auto-updated.

Last update: 2024-10-16 16:48:38 UTC


README

Tap payments gateway for Omnipay payment processing library

Build Status Latest Stable Version Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements Tap support for Omnipay.

Installation

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.

For general usage instructions, please see the main Omnipay repository.

Example usage

Configuration

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

$response = $gateway->purchase([
    'amount' => 1, // Required
    'currency' => 'KWD',  // Optional, Default is USD
    'customerName' => 'Test', // Optional, Default is Test
    'customerEmail' => 'test@test.com', // 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

$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()
}

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.