Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Interkassa Bundle Laravel Package

chub/interkassa-bundle

View on GitHub
Deep Wiki
Context7

InterkassaBundle

Symfony2 InterkassaBundle allows us to get user payments using Interkassa system. Interkassa is the one of the biggest payment system integrator in Russia and Ukraine.

Build Status knp

Installation

Use composer

Add "chub/interkassa-bundle": "*" to your required section of composer.json and run php composer.phar update.

Register your bundle

Add it to your kernel

<?php
// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new ChubProduction\InterkassaBundle\InterkassaBundle(),
    );
    // ...
}

Configuration

Add interkassa section to your app\config.yml

interkassa:
  connections:  # contain shop descriptions
    intercassa:
      shop_id: ololo                     # Shop id (you can get it in your profile)
      secret_key: ololo                  # Secret key (you can get it in your profile)
      fail_url: /profile/balance         # Url to redirect user on transaction fail
      success_url: /profile/balance      # Url to redirect user on transaction success
    #another_shop:
    # ....

Add some routes:

payment_status:
    pattern:   /payment/status/{connection}
    defaults:  { _controller: InterkassaBundle:Payment:status }

payment_success:
    pattern:   /payment/success/{connection}
    defaults:  { _controller: InterkassaBundle:Payment:success }

payment_fail:
    pattern:   /payment/fail/{connection}
    defaults:  { _controller: InterkassaBundle:Payment:fail }

Usage

  • Create your payment item class
<?php
//..
use ChubProduction\InterkassaBundle\Entity\Payment;
use ChubProduction\InterkassaBundle\Service\PaymentItemInterface;

class PaymentItem implements PaymentItemInterface
{
	public function getAmount()
	{
		// return '1.00';
	}

	public function getDescription()
	{
		// return 'ololo';
	}

	public function setPayment(Payment $p)
	{
		// TODO: Implement setPayment() method.
	}
}
  • Create a payment object
$po = new PaymentItem();
  • Redirect user to pay
// Somewhere in your Action
$response = $this->get('payment')->createInvoice($po, 'intercassa');
return $response
  • Check status of the payment
$po->getPayment()->isPaid();

Event system

You can also register your own event subscriber/dispatcher to handle invoice creation, successful or failed transaction. There are InterkassaPaymentEvent object and InterkassaPaymentEvent::ON_INVOICE, InterkassaPaymentEvent::ON_STATUS_SUCCESS, InterkassaPaymentEvent::ON_STATUS_FAIL events for this

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware