mikelovelyuk
mikelovelyuk

Reputation: 4152

Using FirstData with Omnipay

According to the docs, I can submit a form like this (example);

<form method="post" action="https://test.ipg-online.com/connect/gateway/processing">
    <input type="hidden" name="txntype" value="sale">
    <input type="hidden" name="timezone" value="CET"/>
    <input type="hidden" name="txndatetime" value="2015:12:11-09:12:47"/>
    <input type="hidden" name="hash" value="7a17dcc15df2819649ca80b7921"/>
    <input type="hidden" name="storename" value="12345678"/>
    <input type="hidden" name="mode" value="fullpay"/>
    <input type="text"   name="chargetotal" value="13.00"/>
    <input type="hidden" name="currency" value="826"/>
    <input type="hidden" name="responseSuccessURL" value="http://example.co.uk/thanks" />
    <input type="hidden" name="responseFailURL" value="http://example.co.uk/failure" />
    <input type="submit" value="Submit">
</form>

And that will work using something like Postman (but I've not supplied the correct storename here). By "work" I mean, you get through to the their gateway and can enter your card details and shipping address etc.

In order to get the correct hash and txndatetime I can use the FirstData_Connect Omnipay library.

I thought I could just use the public function getData but actually, that requires details about the users card, cvv code, expiry etc. I don't want to have an interface like that on my site, I just want the user to be able to click through to https://test.ipg-online.com/connect/gateway/processing - like in the form example above.

So how do I structure the PHP side to make use of the Omnipay Library? So far I have;

$gateway = Omnipay::create('FirstData_Connect');
$gateway->setStoreId($storeId);
$gateway->setSharedSecret($sharedSecret);

$response = $gateway->purchase(array(
    'returnUrl' => $returnUrl . '?' . http_build_query($arguments),
    'cancelUrl' => $cancelUrl,
    'amount' => $payment->getAmount(),
    'transactionId' => $paymentId,
))->send();

$result = $response->getData();
return $result;

But, as I've said above, I am required to submit the users card details as well. So I get the error;

"message":"The card parameter is required",
"class":"Omnipay\\Common\\Exception\\InvalidRequestException

Upvotes: 0

Views: 512

Answers (1)

delatbabel
delatbabel

Reputation: 3681

OK so it sounds like that you need a gateway that works differently to the current FirstData_Connect and FirstData_Global gateways. Both of those are direct credit card gateways, of the type where you submit a full purchase request including the card data. What you appear to be talking to is a redirect gateway (much like the PayPal gateways).

When you say According to the docs, I can submit a form like this -- what docs are you talking about? I'm not that familiar with FirstData and their various options.

What it sounds like is that you need to develop, or have developed, a new gateway for FirstData which will return a RedirectResponse object containing the URL where you send the customer to to enter their card data and return to your application using one of the response[Success|Failure] URLs that you pass in the initial call. That's basically how PayPal and other redirect gateways work so you may want to start looking there rather than in the existing FirstData gateways.

Upvotes: 0

Related Questions