<?php

if(!isset($data['id'])){
return;	
}

use Omnipay\Omnipay;

$api_key = get_option('mollie_api_key', 'payments');


$gateway = Omnipay::create('Mollie');
$gateway->setApiKey($api_key);
 

$response = $gateway->completePurchase(
	array(
	
		'transactionReference'   => $data['id'],
		 
	)
)->send();

if ($response->isSuccessful()){
	$update_order['transaction_id'] = $response->getTransactionReference(); // a reference generated by the payment gateway
	$update_order['success'] = 'Your payment was successful! ' . $response->getMessage();
	$update_order['is_paid'] = 1;
	$update_order['order_completed'] = 1;
}
 