codehouse/estcard

Nets EstCard implementation

Installs: 24

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/codehouse/estcard

1.0.1 2018-02-25 18:20 UTC

This package is not auto-updated.

Last update: 2025-09-30 22:18:24 UTC


README

Initialise service

<?php
$pathToPrivateKey = '/testkeys/private.key';
$pathToPublicKey = '/testkeys/public.key';
$postBack = 'https://'.$_SERVER['HTTP_HOST'] . '/payment';
$estCardId = '318DC77DC8';
$estCardUrl = 'https://pos.estcard.ee/test-pos/iPayServlet';
$estCard = new \CodeHouse\EstCard\EstCardImpl($pathToPrivateKey, $pathToPublicKey, $postBack, $estCardId, $estCardUrl);

When the service is initialised, create hidden HTML form to submit to service provider

<?php 
/**
 * @var \CodeHouse\EstCard\EstCard $service
 **/ 
$amountInCents = 10000;
$service->getHtmlForm($amountInCents);

The form has ID estcard, to send the form to Nets, use jQuery $('#estcard').submit() The response can be validated using the following snippet

<?php 
/**
 * @var \CodeHouse\EstCard\EstCard $service
 **/ 
$result = $service->validateResponse($_REQUEST);
if ($result == \CodeHouse\EstCard\EstCard::VALIDATE_OK && $response['respcode'] == \CodeHouse\EstCard\EstCard::PAYMENT_OK) {
        // success
}
// signature failed, or payment was not processed

Info

More info in https://www.nets.eu/etee/Pages/Test-keskkond.aspx