PHP code example of ravols / everifin-sdk-php

1. Go to this page and download the library: Download ravols/everifin-sdk-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ravols / everifin-sdk-php example snippets


Config::getInstance()->setClientId('your-client-id')->setClientSecret('your-client-secret')->setClientIban('your-recipient-iban');

$everifinOrderModule = new EverifinOrders; //Represents Everifin Order domain

$createOrderRequest = new CreatePaymentRequest(
    instructionId: '',//if not filled, auto generated by everifin
    amount: 120.99, //float or int
    currency: 'EUR', //Need to be standard currency code
    redirectUrl: 'your-redirect-url', //where customer will land after payment / cancelling the payment on everifin
    recipientIban: Config::getInstance()->getClientIban(),
    senderBankId: 'fkbaredn',
    recipientBankBic: 'uncrskbx',
    variableSymbol: 'variable-symbol', //order number for example, there is a lenght limitation though
    constantSymbol: '0308',
    specificSymbol: '0000000003',
    paymentMessage: 'message-if-you-want',
    externalId: 'ext4123',
    senderEmail:'customer-email',
);

//This response data contain much more than just the link, for this example we are just interested in the redirect link
$createOrderPaymentResponseData = $everifinOrderModule->createOrderPaymentResponse(createPaymentRequest:$createOrderRequest);

$url = $createOrderPaymentResponseData->link;
//Your logic follows with the link - redirect, send via email etc.

//Depending how you build your Config class you may or may not build it again, for this example we start from scratch
Config::getInstance()->setClientId('your-client-id')->setClientSecret('your-client-secret')->setClientIban('your-recipient-iban');

//Lets get details about the payment
$everifinPayment = new EverifinPayments;

//The order id is send to you as a request GET paramter to the redirect url specified in the redirectUrl parameter when creating an order
$responseData = $everifinPayment->getPayment(paymentId: 'f459c0b7-949e-4266-854d-8f451d5e3c68'); //returns GetPaymentResponse object

$statusOfPayment = $responseData->status; //BOOKED, or other status which can be found in the official everifin docs
//Your logic depending on the status follows here - process order, cancel order etc.
bash
composer