Integration Guide Magento 2

Introduction

Our Magento2 plugin offers regular updates and comprehensive integration support, providing a flexible, ready-to-use solution for seamless online payment acceptance:

Offers the following payment methods

  • Credit Cards (Visa, Mastercard, American Express, JCB, Diners Club, Maestro International, Carde Bleue)
  • Amazon Pay (V1) + (V2)
  • Alipay
  • Apple Pay
  • Bancontact
  • Barzahlen
  • EPS
  • iDEAL
  • Klarna Payments
  • Giropay
  • PAYONE Secure Invoice
  • PAYONE Secured Invoice, secured Direct Debit und secured Installments
  • PAYONE Direct Debit
  • PAYONE Open Invoice
  • PAYONE Prepayment
  • PayPal and PayPal Express
  • PayPal v2 and PayPal Express v2
  • PostFinance Card and E-Finance
  • Przelewy24
  • Sofort
  • Ratepay Invoice, Direct Debit and Installments
  • Trustly
  • Unzer Invoice, Direct Debit and Installments
  • WeChat Pay

Stay updated on our latest enhancements and new features, such as payment methods and integration modes, by regularly checking our Release Notes for this plugin!

Current Release: v3.13.1

Requirements

An active PAYONE - Account is required. If you do not have one yet, please contact us.

Plugin Installation

You have 2 ways to install our plugin:

Installation via Composer

composer require payone-gmbh/magento-2
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:clean

Installation via Github

PAYONE - Portal configuration

To send the transaction status to the correct address, log in to the PAYONE Merchant Interface (PMI).

Under Configuration → Payment Portals → YOUR_PORTAL → Advanced → TransactionStatus URL

<SHOPURL>/index.php/payone/transactionstatus

Additional Response-data

In the General settings, enable "Additional Response Data" for both Live and Test modes.

Magento 2 - Admin configuration

  • Click on PAYONE → General

  • Please enter your access data from the PMI here:

We highly recommend using a prefix of up to 5 characters. If no prefix is set, only the Magento order number will be transmitted.
  • Indicate whether to automatically send an invoice email to the customer following a successful payment authorization:

Payment methods setup
  • Click on PAYONE → Payment

  • Enable/disable the desired payment types in the "Enabled" field.

Due to limitations introduced in Magento 2.3.1, all payment methods are enabled by default after the initial installation. Please ensure you deactivate any payment methods you don't need before launching!
Special adjustments

Certain payment methods require special configurations. The following points are relevant only if you use these specific payment methods:

Secured Invoice (new) + Secured Installment

These two payment methods require their own payment portal. Please enter under PAYONE → Payment → Secured Invoice (new) or Secured Installment →  Use Global Settings to "No" and set a separate portal ID.

For partially captured orders, refunds must match the captured amounts, as each capture generates a new receivable.

Klarna
The Klarna payment methods:
 - Klarna Pay Later
 - Klarna Pay Now
 - Klarna Slice it
are grouped in a Klarna Base Payment method.

Ratepay
Ratepay requires the configuration of one or more shop IDs, which you will receive from Ratepay. After adding them, click "Refresh Ratepay Shop-IDs." Valid shop IDs will appear with their settings configured by Ratepay.

Amazon Pay
Integration Settings in Seller Central

Please enter the following URL under Integrator-URL in the item "Integration settings" in Seller Central: https://gpc-sys.pay1.de/gpc/amazon/1.0/notify - the "Seller URL" may remain empty. This URL ensures that the shop receives all notifications from Amazon.

Also please make sure to store all your shop URLs as allowed Javascript Origin in Seller Central.
  1. From the Seller Central home page, select “Integration - Integration Central” from the navigation bar on top-left side
  2. From Integration Central page, scroll down to the “Manage client ID/store ID(s)” section, and click “View client ID/store ID(s)”
  3. If you have an existing client or Store ID registered, review the configuration of the selected store. You can click on the “Edit” link on the right side to edit information
  4. If you click on the “Edit” button, you can edit all the details of the client configuration
  5. From STEP 3, if you click on the “Create new configuration” link on top, you will be able to create a new client configuration providing all the relevant information

Retrieve Configuration in Magento Backend

To activate the payment method, please use the "get configuration" button. This retrieves your client ID and Seller ID from our Platform. You should then see the values in the corresponding fields.

Please note that you can only make live payments after the payment method is allowed for live payments in Seller Central

 

Field Description

Amazon Client ID

Displays the current Client ID

Amazon Seller ID

Displays the current Seller ID

Get configuration

Click this button to retrieve the current configuration from PAYONE.

This payment method won't work before the configuration has been saved!

Amazon Button Type

  • Amazon Pay (normal) 
  • Pay (smaller)
  • Amazon Pay (smallest)

Amazon Button Type

  • Gold
  • Light grey
  • Dark grey

Amazon Mode

  • Automatic (uses the client's default language)
  • Englisch
  • German
  • French
  • Italian
  • Spanish

Amazon Mode
 

  • Always Synchronous
  • Asynchronous on failure

In some cases there can be an interference between our plugin and the Amazon plugin provided in the Magento Core. So if you encounter "strange behavior" like disapperaing amazon buttons, you could try the following command in the magento root:

php bin/magento module:disable Amazon_Payment

creditcard

Under CreditCard-Type, select which credit cards you want to offer.

Determines whether the credit card verification number is queried. This is only possible if the acquirer allows it.

From a purely technical point of view, querying the CVC is optional. However, most end customers are used to the query.

PAYONE Direct Debit

Field Description

Request BIC

Toggles whether the BIC is queried in the checkout. Use this configuration for better compatibility with bank accounts from outside DACH

Validate Bank Code

Turns on a bank account check using "bankaccountcheck" prompt.

This setting is part of our optional Risk Management Module

List of supported SEPA countries

Multiple selection of the countries from which the payment type debit memo is supported. The PAYONE platform currently only supports direct debits for German bank accounts.

Mandates enabled

Select Yes / No. Should the SEPA mandate manager be used? A check of the bank details is obligatory. A check against the POS lock list is not possible.

Mandates download enabled

Select Yes / No. If Yes is selected, a link is offered after the order has been placed, via which the end customer can download the SEPA Mandate as a PDF file.

PayPal v2

In the test system, there is no need to enter a "PayPal Merchant ID" in the PayPal V2 settings. However, when moving to the live environment, the merchant's "PayPal Merchant ID" must be entered here.

You can find a detailed description of where to locate your PayPal Merchant ID in your PayPal account.

Apple Pay

Field Description

Enabled

Yes/ No

Title

Name of the payment method, which appears in the checkout

Apple Pay Merchant Id

This value can be taken from the Apple Developer Portal as "Identifier" of your Merchant ID:

Certificate file

Please upload your Merchant Identification Certificate from the Apple Developer Portal in .pem format. You can convert the merchant_id.cer file to .pem with this console command:

Certificate file
openssl x509 -inform der -in merchant_id.cer -outform pem -out merchant_id.pem

Private key file

Please upload the private key file used to create the Apple Pay CSR here.

Private key password

Here you can set the password for using the private key

Allowed card types

Select here the card types that are allowed for Apple Pay. Please only select the card types here that are also part of your PAYONE contract. 

In addition to the configuration in Magento, it is also necessary to set up the corresponding certificates to operate Apple Pay as a payment method. You can find instructions for this here: Special Remarks - Apple Pay

Additionally, Apple requires validation of the store domain for Apple Pay. To do this, follow the instructions in the Apple Developer Portal:

Editing the orders

Click on PAYONE → Orders

Overview

Here you will find a PAYONE-specific order overview similar to the Magento order overview. In addition to the standard information, you can view the payment status on the PAYONE platform, the exact type of payment (e.g. credit card brands) and, if applicable, the dunning status. A click on View opens the detailed view of the corresponding order.

Capture

Preauthorized transactions have to be captured in order to trigger the actual cash flow. The PAYONE Plugin handles this step during creation of the invoice for a given order. Under PAYONE → Orders → Order view → Invoices you can trigger the capture with the invoice creation.

 

By selecting "Capture Online" in the dropdown list shown above, the debt will be collected on the PAYONE platform. If you do not want to capture the money but still want to create an invoice and receivable, please select "Capture Offline" instead.

Partial captures are also possible by simply adjusting the billable quantity of the items.

Refund

Already captured funds can be returned by creating a credit memo for an existing invoice.

Open the invoice details of the invoice to be credited. Click on Credit Memo in the upper right corner.

 

Enter here the amount to be refunded:

 

By selecting the "Refund" Button here, Money is sent back to the customer's payment method. "Refund Offline" will create the credit memo, but won't trigger any cash flow.

Partial refunds are possible using the same method as with partial captures. You can also adjust the sum of the refund to account for fees during the refund, but keep in mind that some payment methods rely on cart items to match with the initial order.

Extended configurations

Here you will find separate setting options that allow you to customize our plugin more precisely to your needs.

Send invoicing information

Click on PAYONE → General → Send invoicing information activate the transmission of item data to create an invoice on the PAYONE platform.

The text can be freely selected and appears as dynamic text on the invoice or credit note. Various Magento variables can be used as placeholders.

Status Mapping

Click on PAYONE → General → Status Mapping the different transaction statuses of the PAYONE platform can be mapped to Magento order statuses. If a new transaction status is received, the corresponding "Magento status" is set in the order overview in the Magento backend. This can be entered separately for each payment type.

Custom styling hosted-Iframe

Click on PAYONE → General → Payment Creditcard → Input configuration → Custom styling hosted-Iframe

Feld Beschreibung

Active

Yes/No

Digit-count

Length of the field in characters (HTML attribute size)

Width

CSS - Spezifiziert width

CSS

Specification of CSS properties for field
Deactivated with previous selection of Standard

Height

CSS - Indication of height

iFrame

  • Standard - Uses width and height from standard style
  • Custom - Uses width and height from the following fields

iFrame

  • Width - CSS spezification
  • Height - CSS spezification

Language

Select the language in which the error message is to be output.

Standard-style

  • Input  - CSS specification for all input fields (HTML input)
  • Selection - CSS specification for all selection fields (HTML select )

Style

  • Standard - Uses CSS specification from Standard
  • Custom - Uses CSS specification from the following field

Type

  • Numeric  - Only numbers are allowed and for mobile devices the numeric keyboard is used input type="tel"
  • Password - input type="password"
  • Text - input type="text"

Max-digits

Maximum length of input (HTML attribute maxlength) 

Preview

At this point you can see how the appearance looks according to the previous setting of the credit card payment method in Checkout.

 

Simple Protect

Simple Protect is the easy and flexible way of using all the data you have, right in the moment when your shop is proccessing the checkout. You can i.e. gain information from:

  • your magento 2 shop database
  • the current checkout session
  • external sources that can be reached and accessed from the shop server (Datawarehouse; csv / xml / txt - files that can be accessed with PHP; APIs or APIs or extensions like the PAYONE Protect Functions and many more.)

Here is an example of some complex decisions that can be performed using our simple protect framework:

 

Simple Protect is currently under beta stage. If you want to use this functionality you have to download the PAYONE Integration from the Simple Protect branch:

https://github.com/PAYONE-GmbH/magento-2/tree/simple-protect

After that, please follow the intructions for installing the Simple Protect Template here:

https://github.com/PAYONE-GmbH/magento-2-simple-protect

A complete example implementation you will find at:

Please be aware that all functions described in the legacy part of this documentation won't be available anymore when using simple protect. For the time being, we also don't offer a migration mechanism.
Be aware that you have to be compliant as described in the specifications of the GDPR

Implementation
1

First of all you have to initialize a database object:

/**
 * Database connection resource
 *
 * @var \Magento\Framework\App\ResourceConnection
 */
protected $databaseResource;

2

__construct it

/**
 * Constructor
 *
 * @param \Magento\Framework\App\ResourceConnection $resource
 */
public function __construct(
    \Magento\Framework\App\ResourceConnection $resource
)
{

    $this->databaseResource = $resource;
}

3

and then you can ask the database for information like these

/**
 * Get count of customers orders
 *
 * @param CustomerInterface $oCustomer
 * @return int
 */
protected function getCustomersOrderCount(CustomerInterface $oCustomer)
{
    $db = $this->databaseResource->getConnection();
    $oSelect = $db->select()
        ->from($this->databaseResource->getTableName('sales_order'), ['COUNT(entity_id)'])
        ->where("customer_id = :customerId");
    $iCount = $db->fetchOne($oSelect, ['customerId' => $oCustomer->getId()]);
    if ($iCount === null) {
        return 0;
    }
    return $iCount;
}

Execute PAYONE protect checks

to be able for executing the protect check you have to init and construct the PAYONE protectFunnel


/**
 * PAYONE Protect model providing access to consumerscore and addresscheck requests
 *
 * @var \Payone\Core\Model\SimpleProtect\ProtectFunnel
 */
protected $protectFunnel;

public function __construct(
    \Payone\Core\Model\SimpleProtect\ProtectFunnel $protectFunnel
)
{
    $this->protectFunnel = $protectFunnel;
}
addresscheck

here is a simple method to execute the addresscheck with the billing address


/**
 * Example for addresscheck usage
 *
 * @param  Quote $oQuote
 * @return AddresscheckResponse|bool
 */
protected function executeAddresscheck(Quote $oQuote)
{
    $oAddress = $oQuote->getBillingAddress();
    $sAddresscheckType = AddressCheckType::BASIC;

    return $this->protectFunnel->executeAddresscheck($oAddress, $this->getOperationMode(), $sAddresscheckType);
}

if you want to perform the addresscheck on the shipping address you have to change the $oAddress - Variable this way

/**
 * getting the shipping address
 */
$oAddress = $oQuote->getShippingAddress();

maybe you want to use another way / type for the addresscheck there are many more options

/**
 * Examples of all the types for addresscheck usage
 */
$sAddresscheckType = AddressCheckType::NONE;
$sAddresscheckType = AddressCheckType::BASIC;
$sAddresscheckType = AddressCheckType::PERSON;
$sAddresscheckType = AddressCheckType::BONIVERSUM_BASIC;
$sAddresscheckType = AddressCheckType::BONIVERSUM_BASIC;

consumerscore

here is a simple method to perform the consumerscore - request as in the addresscheck described you can also switch the address which you want to check

/**
 * getting the shipping address
 */
$oAddress = $oQuote->getShippingAddress();

all options for the consumerscore are described here

/**
 * Examples of all the options for consumerscore usage
 */
$sConsumerscoreType = CreditratingCheckType::INFOSCORE_HARD;
$sConsumerscoreType = CreditratingCheckType::INFOSCORE_ALL;
$sConsumerscoreType = CreditratingCheckType::INFOSCORE_ALL_BONI;
$sConsumerscoreType = CreditratingCheckType::BONIVERSUM_VERITA;

an example

/**
 * Example for consumerscore usage
 *
 * @param  Quote $oQuote
 * @return ConsumerscoreResponse|bool
 */
protected function executeConsumerscore(Quote $oQuote)
{
    $oAddress = $oQuote->getBillingAddress();
    $sConsumerscoreType = CreditratingCheckType::INFOSCORE_ALL;

    return $this->protectFunnel->executeConsumerscore($oAddress, $this->getOperationMode(), $sConsumerscoreType, $sAddresscheckType);
}

you can use the result from above like this

/**
 * Check the result of executing the consumerscore
 * @return bool
 */
$oResponse = $this->executeConsumerscore($oQuote);
if ($oResponse instanceof ConsumerscoreResponse && ($oResponse->getStatus() != 'VALID' || $oResponse->getScore() != 'G')) {
    return true;
}

In the above example the call $oResponse->getScore() will give you the value score as described here

Filter on the store view

if you need to have other decisions regarding a store view, you can ask for it with the existing magento objects like

/**
 * Change AddressCheckType for the stores
 * @default AddressCheckType::NONE
 */
$sAddresscheckType = AddressCheckType::NONE;
if ($oQuote->getStore()->getName() == 'new Brands') {
    $sAddresscheckType = AddressCheckType::PERSON;
} else if ($oQuote->getStore()->getCode() == 'old_Brands') {
    $sAddresscheckType = AddressCheckType::BASIC;
}

Configuration

Click on PAYONE → Protect

This option only affects requests regarding the PAYONE - API like adresscheck or consumerscore. Any other code will be executed as developed.
Entry points / Points of action

The class app/code/Payone/SimpleProtect/Model/SimpleProtect/SimpleProtect.php is the central point to implement the decisions. The following methods reperesent the points where the actions are taking place.

Example of full implementation
<?php

/**
 * PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PAYONE Magento 2 Connector is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>.
 *
 * PHP version 5
 *
 * @category  Payone
 * @package   Payone_Magento2_SimpleProtect
 * @author    FATCHIP GmbH <support@fatchip.de>
 * @copyright 2003 - 2019 Payone GmbH
 * @license   <http://www.gnu.org/licenses/> GNU Lesser General Public License
 * @link      http://www.payone.de
 */

namespace Payone\SimpleProtect\Model\SimpleProtect;

use Magento\Payment\Model\MethodInterface;
use Magento\Quote\Model\Quote;
use Payone\Core\Model\SimpleProtect\SimpleProtect as OrigSimpleProtect;
use Payone\Core\Model\PayoneConfig;
use Magento\Customer\Api\Data\CustomerInterface;
use Magento\Quote\Model\Quote\Address;
use Payone\Core\Model\Source\AddressCheckType;
use Payone\Core\Model\Source\CreditratingCheckType;
use Magento\Framework\Exception\LocalizedException;
use Payone\Core\Model\Exception\FilterMethodListException;
use Payone\Core\Model\Api\Response\AddresscheckResponse;
use Payone\Core\Model\Api\Response\ConsumerscoreResponse;
use Magento\Quote\Api\Data\AddressInterface;
use Magento\Store\Model\ScopeInterface;

class SimpleProtect extends OrigSimpleProtect
{
    const MODULE_VERSION = '1.0.0';

    /**
     * Whitelist of safe payment methods
     *
     * @var array
     */
    protected $safePaymentMethods = [
        PayoneConfig::METHOD_ADVANCE_PAYMENT,
        PayoneConfig::METHOD_CREDITCARD,
        PayoneConfig::METHOD_PAYPAL
    ];

    /**
     * PAYONE Protect model providing access to consumerscore and addresscheck requests
     *
     * @var \Payone\Core\Model\SimpleProtect\ProtectFunnel
     */
    protected $protectFunnel;

    /**
     * Database connection resource
     *
     * @var \Magento\Framework\App\ResourceConnection
     */
    protected $databaseResource;

    /**
     * Checkout session object
     *
     * @var \Magento\Checkout\Model\Session\Proxy
     */
    protected $checkoutSession;

    /**
     * Scope config object
     *
     * @var \Magento\Framework\App\Config\ScopeConfigInterface
     */
    protected $scopeConfig;

    /**
     * Constructor
     *
     * @param \Payone\Core\Model\SimpleProtect\ProtectFunnel     $protectFunnel
     * @param \Magento\Framework\App\ResourceConnection          $resource
     * @param \Magento\Checkout\Model\Session\Proxy              $checkoutSession
     * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
     */
    public function __construct(
        \Payone\Core\Model\SimpleProtect\ProtectFunnel $protectFunnel,
        \Magento\Framework\App\ResourceConnection $resource,
        \Magento\Checkout\Model\Session\Proxy $checkoutSession,
        \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
    ) {
        parent::__construct($protectFunnel);
        $this->databaseResource = $resource;
        $this->checkoutSession = $checkoutSession;
        $this->scopeConfig = $scopeConfig;
    }

    /**
     * Returns configured operation mode used for the addresscheck and consumerscore
     *
     * @return string
     */
    public function getOperationMode()
    {
        return $this->scopeConfig->getValue('payone_general/global/protect_mode', ScopeInterface::SCOPE_STORES);
    }

    /**
     * Get count of customers orders
     *
     * @param CustomerInterface $oCustomer
     * @return int
     */
    protected function getCustomersOrderCount(CustomerInterface $oCustomer)
    {
        $db = $this->databaseResource->getConnection();
        $oSelect = $db->select()
            ->from($this->databaseResource->getTableName('sales_order'), ['COUNT(entity_id)'])
            ->where("customer_id = :customerId");
        $iCount = $db->fetchOne($oSelect, ['customerId' => $oCustomer->getId()]);
        if ($iCount === null) {
            return 0;
        }
        return $iCount;
    }

    /**
     * Check if the customer has ordered before
     *
     * @param CustomerInterface $oCustomer
     * @return bool
     */
    protected function isRecurringCustomer(CustomerInterface $oCustomer)
    {
        if ($this->getCustomersOrderCount($oCustomer) == 0) {
            return false;
        }
        return true;
    }

    /**
     * Possibility to whiteliste customers with custom functionality
     *
     * @param  CustomerInterface $oCustomer
     * @return bool
     */
    protected function isCustomerWhitelisted(CustomerInterface $oCustomer)
    {
        return true; // implement this for yourself or remove completely
    }

    /**
     * Generate hash of given address for comparison
     *
     * @param  Address $oAddress
     * @return string
     */
    protected function getAddressHash(Address $oAddress) {
        $sAddress  = $oAddress->getFirstname();
        $sAddress .= $oAddress->getLastname();
        $sAddress .= $oAddress->getCity();
        $sAddress .= $oAddress->getPostcode();
        $sAddress .= $oAddress->getCountry();
        $sAddress .= $oAddress->getStreetFull();

        return md5($sAddress);
    }

    /**
     * Compare given addresses, return true if they are the same
     *
     * @param  Address $oBilling
     * @param  Address $oShipping
     * @return bool
     */
    protected function isBillingAndShippingAddressTheSame(Address $oBilling, Address $oShipping)
    {
        if ($this->getAddressHash($oBilling) != $this->getAddressHash($oShipping)) {
            return false;
        }
        return true;
    }

    /**
     * Filter out all payment methods except for the safe payment methods
     *
     * @param  MethodInterface[] $aPaymentMethods
     * @return MethodInterface[]
     */
    protected function getSafePaymentMethods($aPaymentMethods)
    {
        $aReturn = [];
        foreach ($aPaymentMethods as $oPaymentMethod) {
            if (in_array($oPaymentMethod->getCode(), $this->safePaymentMethods) === true) {
                $aReturn[] = $oPaymentMethod;
            }
        }
        return $aReturn;
    }

    /**
     * Examples of all the options for addresscheck usage
     *
     * @param  Quote $oQuote
     * @return AddresscheckResponse|bool
     */
    protected function executeAddresscheck(Quote $oQuote)
    {
        $oAddress = $oQuote->getBillingAddress();
        #$oAddress = $oQuote->getShippingAddress();

        #$sAddresscheckType = AddressCheckType::NONE;
        $sAddresscheckType = AddressCheckType::BASIC;
        #$sAddresscheckType = AddressCheckType::PERSON;
        #$sAddresscheckType = AddressCheckType::BONIVERSUM_BASIC;
        #$sAddresscheckType = AddressCheckType::BONIVERSUM_PERSON;

        return $this->protectFunnel->executeAddresscheck($oAddress, $this->getOperationMode(), $sAddresscheckType, $this->getModuleVersion());
    }

    /**
     * Examples of all the options for consumerscore usage
     *
     * @param  Quote $oQuote
     * @return ConsumerscoreResponse|bool
     */
    protected function executeConsumerscore(Quote $oQuote)
    {
        $oAddress = $oQuote->getBillingAddress();
        #$oAddress = $oQuote->getShippingAddress();

        #$sConsumerscoreType = CreditratingCheckType::INFOSCORE_HARD;
        $sConsumerscoreType = CreditratingCheckType::INFOSCORE_ALL;
        #$sConsumerscoreType = CreditratingCheckType::INFOSCORE_ALL_BONI;
        #$sConsumerscoreType = CreditratingCheckType::BONIVERSUM_VERITA;

        $sAddresscheckType = AddressCheckType::NONE;
        #$sAddresscheckType = AddressCheckType::BASIC;
        #$sAddresscheckType = AddressCheckType::PERSON;
        #$sAddresscheckType = AddressCheckType::BONIVERSUM_BASIC;
        #$sAddresscheckType = AddressCheckType::BONIVERSUM_PERSON;

        return $this->protectFunnel->executeConsumerscore($oAddress, $this->getOperationMode(), $sConsumerscoreType, $sAddresscheckType, $this->getModuleVersion());
    }

    /**
     * Check rules for recurring registered customers
     *
     * @param  Quote $oQuote
     * @return bool
     */
    protected function isOnlySafePaymentApplicableForRecurringCustomer(Quote $oQuote)
    {
        if ($oQuote->getBaseGrandTotal() > 400 || $this->isCustomerWhitelisted($oQuote->getCustomer()) === false) {
            return true;
        }
        return false;
    }

    /**
     * Check rules for first time registered customer
     *
     * @param  Quote $oQuote
     * @param  bool  $blIsPrePaymentSelection
     * @return bool
     */
    protected function isOnlySafePaymentApplicableForInitialOrder(Quote $oQuote, $blIsPrePaymentSelection)
    {
        if ($blIsPrePaymentSelection === false && $this->isBillingAndShippingAddressTheSame($oQuote->getBillingAddress(), $oQuote->getShippingAddress()) === false) {
            return true;
        }

        if ($oQuote->getBaseGrandTotal() > 120) {
            return true;
        }

        if ($blIsPrePaymentSelection === false && !in_array($oQuote->getPayment()->getMethodInstance()->getCode(), $this->safePaymentMethods)) {
            $oResponse = $this->executeConsumerscore($oQuote);
            if ($oResponse instanceof ConsumerscoreResponse && ($oResponse->getStatus() != 'VALID' || $oResponse->getScore() != 'G')) {
                return true;
            }
        }
        return false;
    }

    /**
     * Check if only safe payment methods are applicable
     *
     * @param  Quote $oQuote
     * @param  bool  $blIsPrePaymentSelection
     * @return bool
     */
    protected function isOnlySafePaymentApplicable(Quote $oQuote, $blIsPrePaymentSelection)
    {
        if ($this->checkoutSession->getPayoneSimpleProtectOnlySafePaymentsAllowed() === true) {
            return true;
        }

        if ($oQuote->getCustomerId() === null) { // if guest checkout
            return true;
        }

        if ($this->isRecurringCustomer($oQuote->getCustomer()) === true) {
            return $this->isOnlySafePaymentApplicableForRecurringCustomer($oQuote);
        }
        return $this->isOnlySafePaymentApplicableForInitialOrder($oQuote, $blIsPrePaymentSelection);
    }

    /************************* MAIN SIMPLEPROTECT HOOKS *************************/

    /**
     * This method can be extended for individual custom behaviour
     *
     * Extending this method gives the following possibilities:
     * 1. Filtering out payment methods based on your own rule set
     * 2. Throwing a LocalizedException to send the user back to shipping method selection
     *
     * @param  Quote             $oQuote
     * @param  MethodInterface[] $aPaymentMethods
     * @return MethodInterface[]
     */
    public function handlePrePaymentSelection(Quote $oQuote, $aPaymentMethods)
    {
        if ($this->isOnlySafePaymentApplicable($oQuote, true) === true) {
            return $this->getSafePaymentMethods($aPaymentMethods);
        }
        return $aPaymentMethods;
    }

    /**
     * This method can be extended for individual custom behaviour
     *
     * Extending this method gives the following possibilities:
     * 1. Throwing a LocalizedException will stop the order creation and throw the user back to payment selection with the given thrown message
     * 2. Throwing a FilterMethodListException with an array of safe payment methods will stop the order creation and
     *    throw the user back to payment selection with the given thrown message and remove all other payment methods except for the given ones
     * 3. Finishing the method - so throwing no Exception will finish the order creation
     *
     * @param  Quote $oQuote
     * @return void
     * @throws LocalizedException
     * @throws FilterMethodListException
     */
    public function handlePostPaymentSelection(Quote $oQuote)
    {
        if ($this->isOnlySafePaymentApplicable($oQuote, false) === true) {
            $sMethodCode = $oQuote->getPayment()->getMethodInstance()->getCode();
            if (!in_array($sMethodCode, $this->safePaymentMethods)) {
                $this->checkoutSession->setPayoneSimpleProtectOnlySafePaymentsAllowed(true);
                throw new FilterMethodListException(__('Please select another payment method.'), $this->safePaymentMethods);
            }
        }
    }

    /**
     * This method can be extended to transfer the version of your Simple-Protect implementation to Payone
     * It is recommended to transfer the name of your module and the version, otherwise Payone doesn't know that it is a Simple-Protect call
     *
     * @return string|null
     */
    public function getModuleVersion()
    {
        return 'Payone_SimpleProtect-'.self::MODULE_VERSION;
    }
}

We're curating more samples at Magento 2 - Simple Protect. Here you will find more information on how to gain data for your decisions. You're also invited to add more examples as issues on github or vial email at docs@payone.com.
handlePrePaymentSelection

Implementing this method gives you the following possibilities:

  1. Throwing a LocalizedException will stop the order creation and throw the user back to payment selection with the given thrown message
  2. Throwing a FilterMethodListException with an array of safe payment methods will stop the order creation and throw the user back to payment selection with the given thrown message and remove all other payment methods except for the given ones
  3. Finishing the method - so throwing no Exception will finish the order creation
handlePrePaymentSelection
@param  Quote $oQuote
@param  MethodInterface[] $aPaymentMethods
@return MethodInterface[]

public function handlePrePaymentSelection(Quote $oQuote, $aPaymentMethods)
{
    if ($this->isOnlySafePaymentApplicable($oQuote, true) === true) {
        return $this->getSafePaymentMethods($aPaymentMethods);
    }
    return $aPaymentMethods;
}

handlePostPaymentSelection

Implementing this method gives you the following possibilities:

  1. Throwing a LocalizedException will stop the order creation and throw the user back to payment selection with the given thrown message
  2. Throwing a FilterMethodListException with an array of safe payment methods will stop the order creation and throw the user back to payment selection with the given thrown message and remove all other payment methods except for the given ones
  3. Finishing the method - so throwing no Exception will finish the order creation
handlePostPaymentSelection
@param  Quote $oQuote
@return void
@throws LocalizedException
@throws FilterMethodListException

public function handlePostPaymentSelection(Quote $oQuote)
{
    if ($this->isOnlySafePaymentApplicable($oQuote, false) === true) {
        $sMethodCode = $oQuote->getPayment()->getMethodInstance()->getCode();
        if (!in_array($sMethodCode, $this->safePaymentMethods)) {
            $this->checkoutSession->setPayoneSimpleProtectOnlySafePaymentsAllowed(true);
            throw new FilterMethodListException(__('Please select another payment method.'), $this->safePaymentMethods);
        }
    }
}
handleEnterOrChangeBillingAddress

Implementing this method gives you the following possibilities:

  1. Returning true will just continue the process without changing anything
  2. Returning a (changed) address object instance of AddressInterface will show an address correction prompt to the customer
  3. Throwing a LocalizedException will show the given exception message to the customer
handleEnterOrChangeBillingAddress
@param AddressInterface $oAddressData
@param bool $blIsVirtual
@param double $dTotal
@return AddressInterface|bool
@throws LocalizedException

public function handleEnterOrChangeBillingAddress(AddressInterface $oAddressData, $blIsVirtual, $dTotal)
    {
        $response = $this->protectFunnel->executeAddresscheck($oAddressData, $this->getOperationMode(), AddressCheckType::BASIC);
        if ($oAddressData->getCity() == "FalscheStadt") {
            $oAddressData->setCity($response->getCity());
            return $oAddressData;
        }
        return true;
    }

handleEnterOrChangeShippingAddress

Implementing this method gives you the following possibilities:

  1. Returning true will just continue the process without changing anything
  2. Returning a (changed) address object instance of AddressInterface will show an address correction prompt to the customer
  3. Throwing a LocalizedException will show the given exception message to the customer
handleEnterOrChangeShippingAddress
@param AddressInterface $oAddressData
@param bool $blIsVirtual
@param double $dTotal
@return AddressInterface|bool
@throws LocalizedException

public function handleEnterOrChangeShippingAddress(AddressInterface $oAddressData, $blIsVirtual, $dTotal)
    {
        $response = $this->protectFunnel->executeAddresscheck($oAddressData, $this->getOperationMode(), AddressCheckType::BASIC);
        if ($oAddressData->getCity() == "FalscheStadt") {
            $oAddressData->setCity($response->getCity());
            return $oAddressData;
        }
        return true;
    }

Protect (Legacy)

Click on PAYONE → Protect

Address Validation

Field Beschreibung

Enabled

Activating the address check

Mode

Choice between Test / Live. This determines whether the PAYONE platform is addressed in Test or Live mode.

Check Billing Address

Configuration with which check the invoice address is to be checked.

Check Shipping Address

Configuration with which check the delivery address is to be checked.

Check Billing Address for virtual orders

Select yes/no whether the billing address should be checked for virtual orders.

Confirm address correction

Selection yes/no whether an address correction must be confirmed by the buyer.

Person Status Mapping

Assignment of individual person status returns to a traffic light value.

Works only with the address check "Person", which returns personal information

Message to display for invalid data

Error message to be displayed at status "INVALID"

Response ERROR handling

What should be executed after an error in the extension or the PAYONE platform?

Minimum Order Total

Minimum amount to execute an address check.

Maximum Order Total

Maximum amount to execute an address check.

lifetime

Number of days in which no new address validation is performed.

Credit Assessment

Field Description

Enabled

Activation of the credit rating check

Mode

Choice between Test / Live. This determines whether the PAYONE platform is addressed in Test or Live mode.

Integration Event

Selection of "Before/After" payment selection.

Creditrating-Checktype
 

  • Infoscore (hard criteria, all criteria, all criteria+ Boniscore)
  • Boniversum (VERITA Score)

Default values for unknown scores

Selection of a traffic light color for the return status "Unknown"

only affects Boniversum verita score!

Response ERROR handling

What to do if an error occurs in the integration or on the PAYONE platform?

Insufficient score error message

Message displayed to the customer when an insufficient point value is reached.

Minimum Order Total

Minimum amount to carry out a credit check.

Maximum Order Total

Maximum amount to carry out a credit check.

lifetime

Number of days in which no new credit check is performed.

Service provider for address- and credit checks
Various service providers are available for address and creditworthiness checks. Our support team will be happy to explain the range of services of the individual checks and which service provider is the right one for you.

List of PAYONE IPs

Click on PAYONE → Misc

After the installation, the currently valid IP addresses are specified there. Only change if necessary. You only need to add these addresses if your system landscape works with load balancers or proxy systems, for example. Please consult your admin or hosting service provider.

Transactions-Status Forwarding

Click on PAYONE → Misc

At this point you can define which status is forwarded to which URL and how long the timeout is in seconds until the redirection attempt is terminated.

Invoicing Data

Click on PAYONE → Misc

Invoicing Data - Discount

Here you can define a SKU that shall be used to identify discount items. This can be left blank unless you are experiencing issues with shopping cart items

Invoicing Data - Shipping Costs

Here you can define a SKU that shall be used to identify shipping items. This can be left blank unless you are experiencing issues with shopping cart items.

Invoicing Data - Shipping Costs

Here you can define a SKU that shall be used to identify shipping items. This can be left blank unless you are experiencing issues with shopping cart items.

Invoicing Data - Voucher

Here you can define a SKU that shall be used to identify vouchers. This can be left blank unless you are experiencing issues with shopping cart items.

Export Configuration

Click on PAYONE → Export Configuration

Clicking Export configuration will download a file.

You can now open this file with an XML editor and view or save it. This export is very important for every support request to the PAYONE team in order to avoid possible configuration problems. This file can also be used to determine whether any further extensions have been installed that could cause compatibility problems.

PAYONE Logs

Click on PAYONE → Logs

In the Logs section you can find all the information about the processed payments and communication with the PAYONE platform.

API Logs
Click on PAYONE → API

In this overview you will find all requests from the Magento shop to the PAYONE platform as well as the answers of the PAYONE platform to these requests. Only the requests that were transmitted to the PAYONE platform via Client API are not listed in this overview. This applies to credit card information that is transferred directly from the buyer's browser to the PAYONE platform using Ajax technology so that your shop does not come into contact with sensitive credit card information. By clicking on View, you can display an API request in detail.

In the left column you can see the request that the Magento shop has sent to the PAYONE platform. On the right you will find the answer. A detailed explanation of the respective parameters can be found in the technical documentation of the PAYONE platform in the PAYONE Merchant Interface (PMI) under Downloads → Documentation.

Transaktionsstatus Logs

Click on PAYONE → Transactionsstatus

The Transactions submenu item displays Magento received transaction status notifications for each order and transaction. These notifications are sent from the PAYONE platform to your shop. If there are any errors, you can find out here whether the transaction status was received correctly and what the current status is for a transaction. By clicking on View, you can display details on a transaction status.

On the details page, you will see all the transaction status information transmitted through the PAYONE platform to your shop. Thus, you can always track which data your Magento shop has received and processed.

A detailed explanation of the respective parameters can be found in the technical documentation of the PAYONE platform in the PAYONE Merchant Interface (PMI) under Downloads → Documentation.