PHP code example of eupago / omnipay-eupago
1. Go to this page and download the library: Download eupago/omnipay-eupago 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/ */
eupago / omnipay-eupago example snippets
$gateway = Omnipay::create('Eupago_Multibanco');
// Currency('EUR');
$gateway->setTransactionId('xxxxx');
// Optionally with start/end date
$gateway->setStartDate(new \DateTime);
$gateway->setEndDate((new \DateTime)->modify('48 hours'));
$response = $gateway->purchase(['amount' => '10.00'])->send();
if ($response->isSuccessful()) {
// return the euPago api response with payment credentials
// see src/Message/MultibancoResponse.php methods for more information
$paymentData = $response->getData();
// return the Transaction Reference
// the transaction Reference is
$gateway = Omnipay::create('Eupago_Multibanco');
// The transaction reference is end();
if ($paymentStatus->isPaid()) {
// payment was successful: update database
} else {
// payment failed: display message to customer
echo $paymentStatus->getMessage();
}