I'm currently building an off-site payment solution for a website. I'm using CI-Merchant (I tried to use Omnipay but using Composer doesn't work for me).
I'm currently doing this (in a method of my controller). Also note that I'm using a tweaked version of CI-Merchant to allow sending to PayPal the cart of the customer. I just did these changes : https://github.com/guillermofr/ci-merchant/commit/70ea1a2864971078b3b67e5ca1051be174f23fa0
In my controller file :
//The library and the settings are initialized before
$this->merchant->initialize($this->APISettings);
$order = array(
array(
'name' => 'Voyage 1',
'desc' => 'Relais du Plessis',
'amt' => 50.00,
'qty' => 1
),
array(
'name' => 'Voyage 2',
'desc' => 'Domaine St-Hilaire',
'amt' => 50.00,
'qty' => 1
)
);
$this->session->set_userdata('order',$order);
$params = array(
'amount' => 100.00,
'currency' => 'EUR',
'items' => $order,
'return_url' => base_url().'api/reservation/validation_commande',
'cancel_url' => base_url().'api/reservation/annulation_commande'
);
$this->merchant->authorize($params);
Later, in another method of my controller (the one called when the payment is complete, the return_url) :
$this->merchant->initialize($this->APISettings);
$params = array(
'amount' => 100.00,
'currency' => 'EUR',
'items' => $this->session->userdata('order'),
'return_url' => base_url().'api/reservation/validation_commande',
'cancel_url' => base_url().'api/reservation/annulation_commande'
);
$response = $this->merchant->authorize_return($params);
var_dump($response);
$gateway_reference = $response->reference();
What I want is just keep a footprint of the card, so that's why I'm getting the reference.
Question is, if I want to capture the payment later, how can I do ? I know that the method to call is $this->merchant->capture(); but I don't know what to pass in parameter.
Thanks in advance,
Cheers