All Projects → w3guy → omnipay-2checkout

w3guy / omnipay-2checkout

Licence: MIT license
2Checkout driver for the Omnipay PHP payment processing library

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to omnipay-2checkout

adyen-node-api-library
Adyen API Library for Node.js
Stars: ✭ 82 (+228%)
Mutual labels:  payment, payment-gateway, payment-integration
react-native-payumoney
React Native Payumoney (Android/IOS)
Stars: ✭ 18 (-28%)
Mutual labels:  payment, payment-gateway, payment-integration
adyen-python-api-library
Adyen API Library for Python
Stars: ✭ 41 (+64%)
Mutual labels:  payment, payment-gateway, payment-integration
python-daraja
Python Wrapper for interacting with the MPESA Daraja API. More Features to be implemented
Stars: ✭ 20 (-20%)
Mutual labels:  payment, payment-gateway, payment-integration
wc-moldovaagroindbank
WooCommerce maib Moldova Agroindbank Payment Gateway
Stars: ✭ 13 (-48%)
Mutual labels:  payment, payment-gateway, payment-integration
cybersource-sdk-java
Java SDK for CyberSource Simple Order API
Stars: ✭ 44 (+76%)
Mutual labels:  payment, payment-gateway, payment-integration
adyen-hybris
Adyen Payment plugin for Hybris
Stars: ✭ 23 (-8%)
Mutual labels:  payment, payment-gateway, payment-integration
Paynow-NodeJS-SDK
NodeJS SDK for Zimbabwe's leading payments gateway, Paynow
Stars: ✭ 23 (-8%)
Mutual labels:  payment, payment-gateway, payment-integration
paymentgateway
Dokumentace ČSOB platební brány a jejího eAPI pro platby platebními kartami, Apple Pay, mallpay a platebními tlačítky ČSOB.
Stars: ✭ 104 (+316%)
Mutual labels:  payment, payment-gateway, payment-integration
adyen-dotnet-api-library
Adyen API Library for .NET
Stars: ✭ 69 (+176%)
Mutual labels:  payment, payment-gateway, payment-integration
adyen-salesforce-commerce-cloud
Salesforce Commerce Cloud (formerly Demandware)
Stars: ✭ 63 (+152%)
Mutual labels:  payment, payment-gateway, payment-integration
cybersource-android-sdk
The CyberSource InApp SDK enables developers to simply and securely incorporate mobile payments into their Android applications.
Stars: ✭ 25 (+0%)
Mutual labels:  payment, payment-gateway, payment-integration
nagadApi
This is Bangladeshi nagad payment gateway api development library. This library can be used in any php application.
Stars: ✭ 20 (-20%)
Mutual labels:  payment, payment-gateway, payment-integration
awesome-payment
A curated list of payment services
Stars: ✭ 22 (-12%)
Mutual labels:  payment, payment-gateway, payment-integration
ccashcow
💰 Accept cards & crypto. Payments so easy a cow could do it.
Stars: ✭ 40 (+60%)
Mutual labels:  payment, payment-gateway, payment-integration
omnipay-sagepay
Sage Pay driver for the Omnipay PHP payment processing library
Stars: ✭ 48 (+92%)
Mutual labels:  omnipay, payment-gateway
Sdk Dotnet
.Net SDK for Authorize.Net API
Stars: ✭ 124 (+396%)
Mutual labels:  payment, payment-gateway
Laravel Paddle
Paddle.com API integration for Laravel with support for webhooks/events
Stars: ✭ 132 (+428%)
Mutual labels:  payment, payment-gateway
Adyen Php Api Library
Adyen API Library for PHP
Stars: ✭ 93 (+272%)
Mutual labels:  payment, payment-gateway
Go Payment
Payment Connector for Midtrans and Xendit. Sample site that is using this payment proxy is https://imrenagi.com/donate
Stars: ✭ 136 (+444%)
Mutual labels:  payment, payment-gateway

Omnipay: 2checkout

2checkout gateway for the Omnipay PHP payment processing library

Latest Version on Packagist Software License Build Status Coverage Status Code Climate Dependency Status Total Downloads

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

Install

Via Composer

$ composer require collizo4sky/omnipay-2checkout

Usage

The following gateways are provided by this package:

  • TwoCheckoutPlus
  • TwoCheckoutPlus_Token

TwoCheckoutPlus

use Omnipay\Omnipay;

$gateway = Omnipay::create('TwoCheckoutPlus');
$gateway->setAccountNumber($this->account_number);
$gateway->setSecretWord($this->secret_word);
$gateway->setTestMode($this->is_sandbox_test());
// activate test mode by passing demo parameter to checkout parameters.
$gateway->setDemoMode($this->is_test_mode());


try {
    $formData = array(
        'firstName' => $order->get_billing_first_name(),
        'lastName' => $order->get_billing_last_name(),
        'email' => $order->get_billing_email(),
        'address1' => $order->get_billing_address_1(),
        'address2' => $order->get_billing_address_2(),
        'city' => $order->get_billing_city(),
        'state' => $order->get_billing_state(),
        'postcode' => $order->get_billing_postcode(),
        'country' => $order->get_billing_country(),
    );

    $order_cart = $order->get_items();

    $cart = array();

    $i = 0;
    foreach ($order_cart as $order_item_id => $product) {
        $product_id = $product['product_id'];
        $cart[$i]['name'] = $product['name'];
        $cart[$i]['quantity'] = $product['qty'];
        $cart[$i]['type'] = 'product';
        $cart[$i]['price'] = round($product['line_subtotal'] / $product['qty'], 2);
        $cart[$i]['product_id'] = $product_id;

        $i++;
    }

    if (($shipping_total = $order->get_shipping_total()) > 0) {
        $cart[] = array(
            'name' => 'Shipping Fee',
            'quantity' => 1,
            'type' => 'shipping',
            'price' => round($shipping_total, 2),
        );
    }

    if (($discount_total = $order->get_total_discount()) > 0) {
        $cart[] = array(
            'name' => 'Discount',
            'quantity' => 1,
            'type' => 'coupon',
            'price' => round($discount_total, 2),
        );
    }

    if (($tax_total = $order->get_total_tax()) > 0) {
        $cart[] = array(
            'name' => 'Tax Fee',
            'type' => 'tax',
            'quantity' => 1,
            'price' => round($tax_total, 2),
        );
    }

    $gateway->setCart($cart);

    $response = $gateway->purchase(
        array(
            'card' => $formData,
            'transactionId' => $order->get_order_number(),
            'currency' => 'USD',
            // add a query parameter to the returnUrl to listen and complete payment
            'returnUrl' => $this->returnUrl,
        )
    )->send();


    if ($response->isRedirect()) {
        $response->getRedirectUrl();

    } else {
        $error = $response->getMessage();
    }
} catch (Exception $e) {
    $e->getMessage();
}

TwoCheckoutPlus_Token

use Omnipay\Omnipay;

try {
    $gateway = Omnipay::create('TwoCheckoutPlus_Token');
    $gateway->setAccountNumber($this->account_number);
    $gateway->setTestMode($this->is_sandbox_test());
    $gateway->setPrivateKey($this->private_key);

    $formData = array(
        'firstName' => $order->get_billing_first_name(),
        'lastName' => $order->get_billing_last_name(),
        'email' => $order->get_billing_email(),
        'billingAddress1' => $order->get_billing_address_1(),
        'billingAddress2' => $order->get_billing_address_2(),
        'billingCity' => $order->get_billing_city(),
        'billingPostcode' => $order->get_billing_postcode(),
        'billingState' => $order->get_billing_state(),
        'billingCountry' => $order->get_billing_country(),
    );


    $purchase_request_data = array(
        'card' => $formData,
        'token' => sanitize_text_field($_POST['twocheckout_token']),
        'transactionId' => $order->get_order_number(),
        'currency' => 'USD',
        'amount' => $order->order_total,
    );

    $response = $gateway->purchase($purchase_request_data)->send();

    if ($response->isSuccessful()) {
        $transaction_ref = $response->getTransactionReference();
    } else {
        $error = $response->getMessage();
    }
} catch (Exception $e) {
    $e->getMessage();
}

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

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.

Testing

$ composer test

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].