All Projects → slevomat → csob-gateway

slevomat / csob-gateway

Licence: MIT license
Client library for CSOB card payment gateway

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to csob-gateway

Chowder
Chowder for Android M-Pesa payments.
Stars: ✭ 31 (+24%)
Mutual labels:  payment
africastalking-node.js
Official Node.js SDK for Africa's Talking
Stars: ✭ 113 (+352%)
Mutual labels:  payment
42-cent
Node.js multi-gateway payment processing module
Stars: ✭ 43 (+72%)
Mutual labels:  payment
java-api
Zold Java API
Stars: ✭ 20 (-20%)
Mutual labels:  payment
ccashcow
💰 Accept cards & crypto. Payments so easy a cow could do it.
Stars: ✭ 40 (+60%)
Mutual labels:  payment
omise-magento
Omise Magento Plugin
Stars: ✭ 32 (+28%)
Mutual labels:  payment
ng-payment-card
💳 Responsive credit card component for Angular.
Stars: ✭ 27 (+8%)
Mutual labels:  payment
android-upi-payment
An android library for integrating payment using existing upi apps.
Stars: ✭ 26 (+4%)
Mutual labels:  payment
direct-stripe
Stripe payment button for WordPress websites
Stars: ✭ 12 (-52%)
Mutual labels:  payment
Seamless Integration
Razer Merchant Services Seamless Integration
Stars: ✭ 30 (+20%)
Mutual labels:  payment
ISO8583-Message-Client-java
ISO8583 Message Packer and Unpacker with ISOClient in Java
Stars: ✭ 94 (+276%)
Mutual labels:  payment
adyen-hybris
Adyen Payment plugin for Hybris
Stars: ✭ 23 (-8%)
Mutual labels:  payment
Tinkoff-Acquiring-SDK-Flutter
Flutter Tinkoff Acquiring SDK is a simple way to integrate payments into your mobile application.
Stars: ✭ 42 (+68%)
Mutual labels:  payment
terms-dictionary
Simple definitions of terms, acronyms, abbreviations, companies, and projects related to financial services and Moov.
Stars: ✭ 48 (+92%)
Mutual labels:  payment
wc-moldovaagroindbank
WooCommerce maib Moldova Agroindbank Payment Gateway
Stars: ✭ 13 (-48%)
Mutual labels:  payment
react-stripe-script-loader
A React Component that loads Stripe script if necessary and shows React Stripe Elements
Stars: ✭ 22 (-12%)
Mutual labels:  payment
Banklink
PHP payment library to easily integrate Baltic banklinks (supports old and new iPizza protocol), E-commerce gateaway (Estcard, Nets Estonia), Liisi Payment Link and Pocopay.
Stars: ✭ 34 (+36%)
Mutual labels:  payment
midtrans-nodejs-client
Official Midtrans Payment API Client for Node JS | https://midtrans.com
Stars: ✭ 124 (+396%)
Mutual labels:  payment
eyowo-go
A Go (Golang) client package for the Eyowo Payment service.
Stars: ✭ 13 (-48%)
Mutual labels:  payment
PayBhama
No description or website provided.
Stars: ✭ 16 (-36%)
Mutual labels:  payment

CSOB gateway

Build status Code coverage Latest Stable Version Composer Downloads

This repository provides a client library for ČSOB Payment Gateway.

Library supports all endpoints of eAPI 1.9 except NEJsplátku (loan@shop). Pull requests are welcome.

Older available versions (not actively maintained):

  • Version 5.* supports PHP 7.2 and eAPI 1.8
  • Version 4.* supports PHP 7.2 and eAPI 1.7
  • Version 3.* supports PHP 7 and eAPI 1.6.
  • Version 2.* supports PHP 7 and eAPI 1.5.
  • Version 1.* supports PHP 5.6 and eAPI 1.5.

Installation

The best way to install slevomat/csob-gateway is using Composer:

> composer require slevomat/csob-gateway

Usage

First you have to initialize the payment in gateway and redirect customer to its interface.

WARNING: Please note, that all the prices are in hundredths of currency units. It means that when you wanna init a payment for 1.9 EUR, you should pass here the integer 190.

$apiClient = new ApiClient(
	new CurlDriver(),
	new CryptoService(
		$privateKeyFile,
		$bankPublicKeyFile
	),
	'https://api.platebnibrana.csob.cz/api/v1.8'
);

$requestFactory = new RequestFactory('012345');

// cart has to have at least 1 but most of 2 items
$cart = new Cart(Currency::EUR);
$cart->addItem('Nákup', 1, 1.9 * 100);

$customer = new Customer(
    'Jan Novák',
    '[email protected]',
    mobilePhone: '+420.800300300',
    customerAccount: new CustomerAccount(
        new DateTimeImmutable('2022-01-12T12:10:37+01:00'),
        new DateTimeImmutable('2022-01-15T15:10:12+01:00'),
    ),
    customerLogin: new CustomerLogin(
        CustomerLoginAuth::ACCOUNT,
        new DateTimeImmutable('2022-01-25T13:10:03+01:00'),
    ),
);

$order = new Order(
    OrderType::PURCHASE,
    OrderAvailability::NOW,
    null,
    OrderDelivery::SHIPPING,
    OrderDeliveryMode::SAME_DAY,
    addressMatch: true,
    billing: new OrderAddress(
        'Karlova 1',
        null,
        null,
        'Praha',
        '11000',
        null,
        Country::CZE,
    ),
);

$paymentResponse = $requestFactory->createInitPayment(
	123,
	PayOperation::PAYMENT,
	PayMethod::CARD,
	true,
	$returnUrl,
	HttpMethod::POST,
	$cart,
    $customer,
    $order,
    'some-base64-encoded-merchant-data',
    '123',
    Language::CZ,
    1800,
    1,
    2,
)->send($apiClient);
$payId = $paymentResponse->getPayId();

$processPaymentResponse = $requestFactory->createProcessPayment($payId)->send($apiClient);

// redirect to gateway
header('Location: ' . $processPaymentResponse->getGatewayLocationUrl());

After customer returns from gateway, he is redirected to $returnUrl where you have to process the payment.

try {
    $receivePaymentResponse = $requestFactory->createReceivePaymentRequest()->send($apiClient, $_POST /* $_GET */);
    if ($receivePaymentResponse->getPaymentStatus() === PaymentStatus::S7_AWAITING_SETTLEMENT) {
        // payment was successful!
    }
} catch (VerificationFailedException | InvalidSignatureException $e) {
    // request was not send from csob api
}

Please refer to the CSOB documentation and learn what states you should to check, they are all available as PaymentStatus::S* constants.

Custom ApiClientDriver

API calls are made through ApiClientDriver interface. Library contains two default implementations of driver - CurlDriver and GuzzleDriver. You can also create your own driver by implementing the ApiClientDriver interface, and passing it to ApiClient constructor.

CurlDriver communicates via curl PHP extension, GuzzleDriver uses guzzlehttp/guzzle library. If you want to use GuzzleDriver you need to require guzzlehttp/guzzle package in your composer.json.

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].