GithubHelp home page GithubHelp logo

siraj-haddadin / omnipay-paysera Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prophe1/omnipay-paysera

0.0 0.0 0.0 43 KB

Paysera gateway driver for the Omnipay PHP payment processing library.

License: MIT License

PHP 100.00%

omnipay-paysera's Introduction

Omnipay: Paysera

Paysera gateway driver for the Omnipay PHP payment processing library

Latest Version on Packagist Software License Build Status StyleCI Quality Score Code Coverage Total Downloads

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

Installation

Omnipay is installed via Composer. To install, require league/omnipay and semyonchetvertnyh/omnipay-paysera with Composer:

composer require league/omnipay semyonchetvertnyh/omnipay-paysera

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

Requirements

  • PHP 7.0+
  • Omnipay v3+
  • ext-openssl

Basic Usage

The following gateways are provided by this package:

  • Paysera

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

Code Example

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');

// Optionally to determine which order has been paid
$orderId = 1;

// Example card (actually customer) data
$card = [
    'email' => '[email protected]',
    'billingFirstName' => 'John',
    'billingLastName' => 'Doe',
    'billingPhone' => '+372 12345678',
    'billingCompany' => 'Good Workers Ltd.',
    'billingAddress1' => 'Viru valjak 24',
    'billingCity' => 'Tallinn',
    'billingPostcode' => '123456',
    'billingCountry' => 'EE',
];

// Send purchase request
$response = $gateway->purchase(
    [
        'language' => 'ENG',
        'transactionId' => $orderId,
        'paymentMethod' => 'hanzaee',
        'amount' => '10.00',
        'currency' => 'EUR',
        'returnUrl' => "https://example.com/paysera/return/{$orderId}",
        'cancelUrl' => "https://example.com/paysera/cancel/{$orderId}",
        'notifyUrl' => "https://example.com/paysera/notify/{$orderId}",
        'card' => $card,
    ]
)->send();

if ($response->isRedirect()) {
    return $response->redirect();
}

You should also implement method for notifyUrl. After successful charging, Paysera sends a request to this URL.

use Omnipay\Omnipay;

// Setup payment gateway
$gateway = Omnipay::create('Paysera');
$gateway->setProjectId('123456');
$gateway->setPassword('abcde12345');

// Accept the notification
$response = $gateway->acceptNotification()
    ->send();
    
if ($response->isSuccessful()) {
    // Mark the order as paid

    return true;
}

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

omnipay-paysera's People

Contributors

semyonchetvertnyh avatar siraj-haddadin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.