Omnipay

-- Genel, PHP

Omnipay Çoklu Ödeme Sistemi

Omnipay; PHP tabanlı, online ödeme sistemleri için sanal pos kütüphanesi. Hali hazırda dünya genelinde 87+ ödeme sistemi için kullanılabilir durumda. Türkiye için benim hazırladığım 5 adet ödeme sistemi bulunuyor.

Kurulum

Kurulum işlemi composer paket yönetici ile gerçekleşiyor. Sisteminizde composer kurulu olması gerekli.

Kullanacağınız ödeme sistemi için ayrı ayrı kurulum yapabilirsin. Tüm ödeme sistemleri için geliştiricinin hazırladığı kurulum ve kullanım dokümanları mevcut. Aşağıdaki bağlantıdan göz atabilirsiniz..

 

Komut yapısı;

composer require geliştirici/paketadi~versiyon

Örnek;

NestPay örneğimiz için komut satırındaki aşağıdaki komutu çalıştıralım. Composer bizim için gerekli olan bağımlılıkları vendor klasörüne indirecek.

composer require yasinkuyu/omnipay-nestpay:~2.0

omnipay-nestpay

Composer gerekli Omnipay dosyalarını test klasöründe bulunan vendor klasörüne aktardı.

composer-omnipay

Ben örnek için odeme.php dosyasını oluşturdum.

Composer autoload dosyasını projeye dahil ederek kullanmaya başlayabilirsiniz.

 require __DIR__ . '/vendor/autoload.php';

Nestpay nesnesini oluştrarak ayarları tanımlayalım

 use Omnipay\Omnipay;

 $gateway = Omnipay::create('NestPay');
 $gateway->setBank("denizbank");
 $gateway->setUserName("DENIZTEST");
 $gateway->setClientId("800100000");
 $gateway->setPassword("DENIZTEST123");
 $gateway->setTestMode(TRUE);

Kart ve kullanıcı bilgilerini tanımlayalım.

$options = [
  'number' => '5406675406675403',
  'expiryMonth' => '12',
  'expiryYear' => '2017',
  'cvv' => '000',
  'email' => 'yasinkuyu@gmail.com',
  'firstname' => 'Yasin',
  'lastname' => 'Kuyu'
  ];

Şimdi satış işlemini gerçekleştirelim.

$response = $gateway->purchase(
  [
  //'installment' => '', # Taksit
  //'moneypoints' => 1.00, // Set money points (Maxi puan gir)
  'amount' => 12.00,
  'type' => 'Auth',
  'orderid' => 'ORDER-3651233',
  'card' => $options
  ]
)->send();

Dönen yanıtlar

var_dump($response);

 

Tam örnek;

 
<?php
//odeme.php

require __DIR__ . '/vendor/autoload.php';

use Omnipay\Omnipay;

$gateway = Omnipay::create('NestPay');

$gateway->setBank("denizbank");
$gateway->setUserName("DENIZTEST");
$gateway->setClientId("800100000");
$gateway->setPassword("DENIZTEST123");
$gateway->setTestMode(TRUE);

$options = [
'number'        => '5406675406675403',
'expiryMonth'   => '12',
'expiryYear'    => '2017',
'cvv'           => '000',
'email'         => 'yasinkuyu@gmail.com',
'firstname'     => 'Yasin',
'lastname'      => 'Kuyu'
];

try {

$response = $gateway->purchase(
[
//'installment'  => '', # Taksit
//'moneypoints'  => 1.00, // Set money points (Maxi puan gir)
'amount'        => 12.00,
'type'          => 'Auth',
'orderid'       => 'ORDER-3651233',
'card'          => $options
]
)->send();
/*
$response = $gateway->authorize(
[
'type'          => 'PostAuth',
'orderid'       => 'ORDER-365123',
'card'          => $options
]
)->send();

$response = $gateway->capture(
[
'orderid'       => 'ORDER-365123',
'amount'        => 1.00,
'currency'      => 'TRY',
'card'          => $options
]
)->send();

$response = $gateway->refund(
[
'orderid'       => 'ORDER-365123',
'amount'        => 1.00,
'currency'      => 'TRY',
'card'          => $options
]
)->send();

$response = $gateway->credit(
[
'orderid'       => 'ORDER-365123',
'amount'        => 1.00,
'currency'      => 'TRY', // Optional (default parameter TRY)
'card'          => $options
]
)->send();

$response = $gateway->void(
[
'orderid'       => 'ORDER-365123',
'amount'        => 1.00,
'currency'      => 'TRY',
'card'          => $options
]
)->send();

$response = $gateway->credit(
[
'amount'        => 1.00,
'card'          => $options
]
)->send();

$response = $gateway->settle(
[
'settlement'   => true,
'card'         => $options
]
)->send();

$response = $gateway->money(
[
'moneypoints'  => "1",
'card'         => $options
]
)->send();
*/

if ($response->isSuccessful()) {
echo "Successful";

} elseif ($response->isRedirect()) {
$response->redirect();

} else {
exit($response->getMessage());
}
} catch (\Exception $e) {
exit('Sorry, there was an error processing your payment. Please try again later.');
}

// Debug
//var_dump($response);

Omnipay-nestpay

https://github.com/yasinkuyu/omnipay-nestpay

Kullanılabilir Ödeme sistemleri
Gateway Composer Package Maintainer
2Checkout omnipay/2checkout Omnipay
2Checkout Improved collizo4sky/omnipay-2checkout Agbonghama Collins
Agms agmscode/omnipay-agms Maanas Royy
Alipay(Global) lokielse/omnipay-global-alipay Loki Else
Alipay lokielse/omnipay-alipay Loki Else
Allied Wallet delatbabel/omnipay-alliedwallet Del
Authorize.Net omnipay/authorizenet Jason Judge
Barclays ePDQ samvaughton/omnipay-barclays-epdq Sam Vaughton
Beanstream lemonstand/omnipay-beanstream LemonStand
BKM Express yasinkuyu/omnipay-bkm Yasin Kuyu
Buckaroo omnipay/buckaroo Omnipay
CardGate cardgate/omnipay-cardgate CardGate
CardSave omnipay/cardsave Omnipay
Checkout.com fotografde/checkoutcom fotograf.de
Coinbase omnipay/coinbase Omnipay
Creditcall meebio/omnipay-creditcall John Jablonski
Cybersource dioscouri/omnipay-cybersource Dioscouri Design
Cybersource SOAP dabsquared/omnipay-cybersource-soap DABSquared
DataCash coatesap/omnipay-datacash Andrew Coates
Dummy omnipay/dummy Del
ecoPayz dercoder/omnipay-ecopayz Alexander Fedra
Elavon lemonstand/omnipay-elavon LemonStand
eWAY omnipay/eway Del
Fasapay andreas22/omnipay-fasapay Andreas Christodoulou
Fat Zebra delatbabel/omnipay-fatzebra Del
First Data omnipay/firstdata Andrew Coates
Flo2cash guisea/omnipay-flo2cash Aaron Guise
Globalcloudpay dercoder/omnipay-globalcloudpay Alexander Fedra
GoCardless omnipay/gocardless Del
GovPayNet omnipay/omnipay-govpaynet FlexCoders
GVP (Garanti) yasinkuyu/omnipay-gvp Yasin Kuyu
Helcim academe/omnipay-helcim Jason Judge
IfthenPay ifthenpay/omnipay-ifthenpay Rafael Almeida
Iyzico yasinkuyu/omnipay-iyzico Yasin Kuyu
Komerci (Rede, former RedeCard) byjg/omnipay-komerci João Gilberto Magalhães
Komoju vink/omnipay-komoju Danny Vink
Manual omnipay/manual Del
Migs omnipay/migs Omnipay
Mollie omnipay/mollie Barry vd. Heuvel
MOLPay leesiongchan/molpay Lee Siong Chan
MultiCards incube8/omnipay-multicards Del
MultiSafepay omnipay/multisafepay Alexander Deruwe
NestPay (EST) yasinkuyu/omnipay-nestpay Yasin Kuyu
Netaxept (BBS) omnipay/netaxept Omnipay
Netbanx omnipay/netbanx Maks Rafalko
Neteller alfaproject/omnipay-neteller João Dias
NetPay netpay/omnipay-netpay NetPay
Network Merchants Inc. (NMI) mfauveau/omnipay-nmi Matthieu Fauveau
Pacnet mfauveau/omnipay-pacnet Matthieu Fauveau
Pagar.me descubraomundo/omnipay-pagarme Descubra o Mundo
PayFast omnipay/payfast Omnipay
Payflow omnipay/payflow Del
PaymentExpress (DPS) omnipay/paymentexpress Del
PaymentSense coatesap/omnipay-paymentsense Andrew Coates
PaymentWall incube8/omnipay-paymentwall Del
PayPal omnipay/paypal Del
PayPro paypronl/omnipay-paypro Fruitcake Studio
Paysafecard dercoder/omnipay-paysafecard Alexander Fedra
PayTrace softcommerce/omnipay-paytrace Oleg Ilyushyn
PayU omnipay/payu efesaid
Pin Payments omnipay/pin Del
Portmanat dercoder/omnipay-portmanat Alexander Fedra
Posnet yasinkuyu/omnipay-posnet Yasin Kuyu
Postfinance bummzack/omnipay-postfinance Roman Schmid
Realex coatesap/omnipay-realex Andrew Coates
RedSys nazka/sermepa-omnipay Javier Sampedro
RentMoola rentmoola/omnipay-rentmoola Geoff Shaw
Sage Pay omnipay/sagepay Jason Judge
SecPay justinbusschau/omnipay-secpay Justin Busschau
SecurePay omnipay/securepay Omnipay
Secure Trading meebio/omnipay-secure-trading John Jablonski
Sisow fruitcakestudio/omnipay-sisow Fruitcake Studio
Skrill alfaproject/omnipay-skrill João Dias
Sofort aimeoscom/omnipay-sofort Aimeos GmbH
Stripe omnipay/stripe Del
TargetPay omnipay/targetpay Alexander Deruwe
UnionPay lokielse/omnipay-unionpay Loki Else
Vantiv lemonstand/omnipay-vantiv LemonStand
Veritrans andylibrian/omnipay-veritrans Andy Librian
WebMoney dercoder/omnipay-webmoney Alexander Fedra
WeChat labs7in0/omnipay-wechat 7IN0’s Labs
WechatPay lokielse/omnipay-wechatpay Loki Else
WePay collizo4sky/omnipay-wepay Agbonghama Collins
Wirecard igaponov/omnipay-wirecard Igor Gaponov
WorldPay omnipay/worldpay Omnipay
WorldPay XML Direct teaandcode/omnipay-worldpay-xml Dave Nash
Yandex.Money aTastyCookie/yandexmoney_omnipay Roman Ananyev
Omnipay.

https://github.com/thephpleague/omnipay

Benzer Yazılar: