Java example

Download

Java example can be downloaded here

Description

This is a sample minimal implementation of the service provider integration

  • Redirects to the authorization server
  • Replies the authorization code
  • Web server POST a token request with the authorization code
  • Decode the token content
  • Link the customer and Unlink
  • Retrieve Data with get Basket Call
  • Request a payment
  • Get the well known configuration for OIDC
  • Request a new Access Token via refresh Token

How to run

mvn spring-boot:run

Access the application

http://localhost:9000 - Jump to the sample service provider welcome page

PHP - Symfony

Download

Symfony example can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment
  • Ability to data transfer

Installation & Configuration Guide

  1. Add required libraries
  2. composer require knpuniversity/oauth2-client-bundle
    composer require firebase/php-jwt

  3. Add parameters to parameters.yml.dist and parameters.yml
  4. verimi_client_id: ~
    verimi_client_secret: ~
    verimi_base_domain: ~
    verimi_api_domain: ~
    verimi_cert_private_key: ~
    verimi_signature_validation_cert: ~
    
    The parameters above should be delivered by Verimi, for test (sandbox) usage:

    • client id: ACME
    • client secret: G|41|0an18ZIs_w
    • base domain and api domain: https://web.uat.verimi.cloud
    • verimi_cert_private_key and verimi_signature_validation_cert should be relative path (from web directory) to file

    Value for verimi_signature_validation_cert is available here:
    https://web.uat.verimi.cloud/dipp/api/.well-known/jwks.json
    as JWKS.
    The key has to be converted to PEM format.
    To do so just execute this code snipped on RunKit:

    var jwkToPem = require("jwk-to-pem")
    var jwk = {"kty":"RSA","alg":"RS256","use":"sig","n":"ENTER KEY HERE","e":"AQAB"};
    pem = jwkToPem(jwk);
    

  5. Import config
  6. {
        resource: "@VerimiOAuth2ClientBundle/Resources/config/config.yml" 
    }
    

  7. Add routing
  8. verimi_o_auth2_client:
    resource: "@VerimiOAuth2ClientBundle/Resources/config/routing.yml"
    prefix:   /
    

  9. Add authenticator guard in security.yml
  10. guard:
        authenticators:
        - verimi_o_auth2_authenticator
    

  11. Add connect button in twig template
  12. {%
        include '@verimi/verimi-connect.html.twig' 
    %}
    

  13. Add login button in twig template
  14. {%
        include '@verimi/verimi-connect.html.twig'
    %}
    

Hosts/URLs

Hosts wich redirect to Verimi environment have to be registered at Verimi.
E.g. https://localhost/code/ has to be added by Verimi.
Please contact Integration Support
For testing purposes following URL is already preregistered for ACME client: https://localhost:8080/code

Usage

Login with Verimi

OAuth2 process
$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->redirect();

Connect with Verimi

$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->connect();

Disconnect from Verimi

$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->disconnect();

Read basket from Token

The $accessToken have to be instance of League\OAuth2\Client\Token\AccessToken
$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->fetchBasket(AccessToken $accessToken);

Read auto push notifications

The $range have to be instance of Verimi\OAuth2ClientBundle\Client\Range
$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->fetchNotifications(Range $range);

Read auto push basket

$url have to be string and have to be provide in the notification feed items
$this->get('oauth2.registry')
     ->getClient('verimi_oauth')
     ->fetchAutoPush($url);

Payment create

Your ordered item class have to implement interface Verimi\OAuth2ClientBundle\Payment\OrderItemInterface Your order class have to implement interface Verimi\OAuth2ClientBundle\Payment\OrderInterface
To create order please run method:
$payment = $this->container->get(\Verimi\OAuth2ClientBundle\Payment\Payment::class);
$payment->create($order);
$order have to implement interface Verimi\OAuth2ClientBundle\Payment\OrderInterface
then pass the payment to:
$this->get('oauth2.registry')
    ->getClient('verimi_oauth')
    ->createPayment($this->container, $payment);
the createPayment method returns instance of ResponseInterface
For handle the Verimi Payment Id and store it into the DB you have to handle verimi.payment.create event
YOUR_BUNDLE\EventListener\PaymentCreateListener:
    tags:
        - { name: kernel.event_listener, event: verimi.payment.create, method: onPaymentCreateEvent }
example:
use Verimi\OAuth2ClientBundle\Payment\Event\PaymentCreateEvent;

class PaymentCreateListener
{
    public function onPaymentCreateEvent(PaymentCreateEvent $event): void
    {
        // your code
    }
}
For handle payment status you need to implement event listener:
YOUR_BUNDLE\EventListener\PaymentListener:
    tags:
        - { name: kernel.event_listener, event: kernel.request }
example:
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;

class PaymentListener
{
    public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        if ('verimi_o_auth2_client_payment_failure' !== $event->getRequest()->get('_route') && 'verimi_o_auth2_client_payment_correct' !== $event->getRequest()->get('_route')) {
            return;
        }

        switch ($event->getRequest()->get('_route'))
        {
            case 'verimi_o_auth2_client_payment_failure':
                $this->paymentFailure($event->getRequest()->get('paymentId'));
                break;
            case 'verimi_o_auth2_client_payment_correct':
                $this->paymentCorrect($event->getRequest()->get('paymentId'));
                break;
        }

        $event->setResponse(new RedirectResponse({URL_TO_REDIRECT}));
    }

    private function paymentCorrect(string $paymentId): void
    {
        // your code
    }

    private function paymentFailure(string $paymentId): void
    {
        // your code
    }
}
In case of payment refund you have to create payment:
$payment = $this->container->get(\Verimi\OAuth2ClientBundle\Payment\Payment::class);
$payment->create($order);
$order have to implement interface Verimi\OAuth2ClientBundle\Payment\OrderInterface
set PaymentId:
$payment->setPaymentId($paymentId);
then pass the payment to:
$this->get('oauth2.registry')
    ->getClient('verimi_oauth')
    ->refundPayment($this->container, $payment, $reason);
For handle the Verimi Payment Refund and store it into the DB you have to handle verimi.payment.refund event
YOUR_BUNDLE\EventListener\PaymentRefundListener:
    tags:
        - { name: kernel.event_listener, event: verimi.payment.refund, method: onPaymentRefundEvent }
example:
use Verimi\OAuth2ClientBundle\Payment\Event\PaymentRefundEvent;

class PaymentRefundListener
{
    public function onPaymentRefundEvent(PaymentRefundEvent $event): void
    {
        // your code
    }
}

PHP - WordPress

Download

Wordpress plugin can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment

Description

Verimi delivers sample plugin for WordPress integration.
With this plugin you are able to use "Login with Verimi" functionality on your WordPress pages. Also this plugin add ability to Pay with Verimi under WooCommerce plugin.

Installation

  • Download the verimi-oauth2.zip
  • Install the Plugin in the plugin menu in WordPress
  • Go to settings in dashboard for usage options
  • Add Client ID and Client Secret you received from Verimi
  • Extract Certificate and Key from the .p12 File like that:
    • Extract Certificate: openssl pkcs12 -in ./verimi.p12 -clcerts -nokeys -out certificate.pem
    • Extract Private Key: openssl pkcs12 -in ./verimi.p12 -clcerts -nodes -nocerts -out private_key.pem
    • On Windows you might need to prepend winpty
  • Add Certificate and private key in the private key field, therefore open the new generated files and copy everything including the tags "-----BEGIN ... KEY-----" and add it to the private key field

PHP - Magento 1

Download

Magento 1.9 plugin can be downloaded here

Supports

  • Ability to account linking
  • Ability to payment

Description

Verimi delivers sample plugin for Magento integration.

Installation

  1. Go to your Magento installation directory
  2. Unzip magento-integration.zip into app/code
  3. Use your favourite shell (i.e. bash or zsh) to run following:
    1. bin/magento setup:upgrade
      bin/magento module:enable Verimi_OAuth2
  4. Go to Store Configuration in Admin area to set up Verimi details
  5. In case of using ability to Pay with Verimi you have to enable this kind of payment. Pay with Verimi supports only EURO.

PHP - Magento 2

Download

Magento plugin can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment

Description

Verimi delivers sample plugin for Magento integration.

Installation

  1. Go to your Magento installation directory
  2. Unzip magento-integration.zip into app/code
  3. Use your favourite shell (i.e. bash or zsh) to run following:
    1. bin/magento setup:upgrade
      bin/magento module:enable Verimi_OAuth2
  4. Go to Store Configuration in Admin area to set up Verimi details
  5. In case of using ability to Pay with Verimi you have to enable this kind of payment. Pay with Verimi supports only EURO.

PHP - Drupal

Download

Drupal (version 7.x) plugin can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment

Description

Verimi delivers plugin for Drupal integration.

Installation

  1. Go to your Drupal installation directory
  2. Unzip plugin archive into sites/all/modules
  3. LogIn to Dashboard and go to Modules and activate Verimi OAuth2 modules
  4. Go to OAuth2 Settings and provide Verimi details

Payment

Payment create Your ordered item class have to implement interface verimi_oauth2\payment\OrderItemInterface Your order class have to implement interface verimi_oauth2\payment\OrderInterface
To create order please run method:
$client->createPayment($payment)
$payment have to implement interface verimi_oauth2\payment\PaymentInterface
before you pass the $payment to createPayment you have to create payment that's mean you have to call
$payment->create($order)
$order have to implement interface verimi_oauth2\payment\OrderInterface For handle payment status you need to implement add logic to methods: paymentCorrect and paymentFailure under verimi_oauth2.module file
In case of payment refund you have to create payment:
$payment->create($order);
$order have to implement interface Verimi\OAuth2Bundle\Payment\OrderInterface set PaymentId:
$payment->setPaymentId($paymentId);
then pass the payment to:
$client->refundPayment($payment, $reason);

PHP - ShopWare

Download

Shopware (version 5.4.4) modiule can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment

Description

Verimi delivers module for Shopware integration.

Installation

  1. Go to your Shopware installation directory
  2. Unzip module archive into custom/plugins
  3. LogIn to Dashboard and go to Plugin Manager and activate Verimi OAuth2 plugin
  4. Go to Plugin Configuration and provide Verimi details
  5. Enable Pay with Verimi in payment settings

PHP - Oxid

Download

Oxid (version 6) modiule can be downloaded here

Supports

  • Ability to login
  • Ability to account linking

Description

Verimi delivers module for Oxid 6 integration.

Installation

  1. Go to your Oxid installation directory
  2. Unzip module archive into source/modules/
  3. LogIn to Dashboard and go to Extensions -> Modules and activate Verimi OAuth2 module
  4. Go to Module settings and provide Verimi details

PHP - Contao

Download

Contao (version 4.6) modiule can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment

Description

Verimi delivers module for Contao integration.

Installation

  1. Unzip downloaded file in any place on FTP/local system
  2. Add parameters below to app/config/parameters.yml
  3. verimi_client_id: Client ID received from Verimi TEAM
    verimi_client_secret: Secret received from Verimi TEAM
    verimi_mode: uat or prod
    verimi_redirect_uri: redirect URI passed in Verimi setup
    verimi_private_key: key is necessery for 2-way TLS communication
                                        
  4. Add this code to composer.json of your Contao project:
    "repositories": {
        "verimisdk/oauth2-bundle": {
            "type": "path",
            "url": "path/to/verimisdk/oauth2-bundle",
            "options": {
                "symlink": true
            }
        }
    }
                                        
  5. In url option pass relative or absolute path to verimisdk/oauth2-bundle
  6. Run command
    composer update
  7. Run command
    contao install tool
  8. There are avaliable two new modules in Contao Dashboard
    • Verimi Login - for ability to Login with Verimi
    • Verimi Linkage - for ability to connect/disconnect with Verimi

Payment create

Your ordered item class have to implement interface Verimi\OAuth2Bundle\Payment\OrderItemInterface Your order class have to implement interface Verimi\OAuth2Bundle\Payment\OrderInterface To create order please run method:

$payment = $this->container->get(\Verimi\OAuth2Bundle\Payment\Payment::class);
$payment->create($order);
$order have to implement interface Verimi\OAuth2Bundle\Payment\OrderInterface then pass the payment to:
$this->container
	->get('verimi.client')
    ->createPayment($this->container, $payment);
the createPayment method returns instance of ResponseInterface
For handle the Verimi Payment Id and store it into the DB you have to handle verimi.payment.create event
YOUR_BUNDLE\EventListener\PaymentCreateListener:
    tags:
        - { name: kernel.event_listener, event: verimi.payment.create, method: onPaymentCreateEvent }
example:
use Verimi\OAuth2Bundle\Payment\Event\PaymentCreateEvent;

class PaymentCreateListener
{
    public function onPaymentCreateEvent(PaymentCreateEvent $event): void
    {
        // your code
    }
}
For handle payment status you need to implement event listener:
YOUR_BUNDLE\EventListener\PaymentListener:
    tags:
        - { name: kernel.event_listener, event: kernel.request }
example:
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;

class PaymentListener
{
    public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        if ('verimi_o_auth2_client_payment_failure' !== $event->getRequest()->get('_route') && 'verimi_o_auth2_client_payment_correct' !== $event->getRequest()->get('_route')) {
            return;
        }

        switch ($event->getRequest()->get('_route'))
        {
            case 'verimi_o_auth2_client_payment_failure':
                $this->paymentFailure($event->getRequest()->get('paymentId'));
                break;
            case 'verimi_o_auth2_client_payment_correct':
                $this->paymentCorrect($event->getRequest()->get('paymentId'));
                break;
        }

        $event->setResponse(new RedirectResponse({URL_TO_REDIRECT}));
    }

    private function paymentCorrect(string $paymentId): void
    {
        // your code
    }

    private function paymentFailure(string $paymentId): void
    {
        // your code
    }
}
In case of payment refund you have to create payment:
$payment = $this->container->get(\Verimi\OAuth2Bundle\Payment\Payment::class);
$payment->create($order);
$order have to implement interface Verimi\OAuth2Bundle\Payment\OrderInterface
set PaymentId:
$payment->setPaymentId($paymentId);
then pass the payment to:
$this->container
	->get('verimi.client')
    ->refundPayment($this->container, $payment, $reason);
For handle the Verimi Payment Refund and store it into the DB you have to handle verimi.payment.refund event
YOUR_BUNDLE\EventListener\PaymentRefundListener:
    tags:
        - { name: kernel.event_listener, event: verimi.payment.refund, method: onPaymentRefundEvent }
example:
use Verimi\OAuth2Bundle\Payment\Event\PaymentRefundEvent;

class PaymentRefundListener
{
    public function onPaymentRefundEvent(PaymentRefundEvent $event): void
    {
        // your code
    }
}

PHP - Prestashop 1.7

Download

Prestashop module can be downloaded here

Supports

  • Ability to login
  • Ability to account linking
  • Ability to payment
  • Ability to refund

Description

Verimi delivers sample module for Prestashop integration.
With this module you are able to use "Login with Verimi" functionality on your e-commerce. Also this module add ability to Pay with Verimi.

Installation

  1. Unzip prestashop_1.7.zip into /modules/
  2. Activate module trough the Module Manager menu in Dashboard
  3. Go to settings in dashboard for usage options