2

You know how generic error messages arent much helpfull.

I'm trying to get Omnipay to work with Pin Payments.

This is what I have so far:

    <?php
require 'vendor/autoload.php';
use Omnipay\CreditCard;
use Omnipay\Common\GatewayFactory;

$gateway = GatewayFactory::create('Pin');


    $gateway->setSecretKey('KEY'); // TEST
    $formData = ['number' => '4111111111111111', 'cvv' => '333','expiryMonth' => 6, 'expiryYear' => 2016];
    $response = $gateway->purchase([
      'email'       => 'customer@customer.com.au',
      'description' => 'Widgets',
      'amount'      => '49.99',
      'currency'    => 'USD',
      'card_token'  => 'card_nytGw7koRg23EEp9NTmz9w',
      'testMode'    => true,
      'ip_address'  => '203.192.1.172',
      'card' => $formData


    ])->send();
    if ($response->isSuccessful()) {
    // payment was successful: update database
    print_r($response);
    } elseif ($response->isRedirect()) {
        // redirect to offsite payment gateway
        $response->redirect();
    } else {
        // payment failed: display message to customer
        exit($response->getMessage());
    }
    echo $response->getMessage();
?>

And this is the error I get: One or more parameters were missing or invalid

Any help appreciated:)

user30899
  • 27
  • 6

2 Answers2

0

Problem Solved:

$response = $gateway->purchase([
      'email'       => 'customer@customer.com.au',
      'description' => 'Widgets',
      'amount'      => '49.99',
      'currency'    => 'USD',
      'card_token'  => 'card_nytGw7koRg23EEp9NTmz9w',
      'testMode'    => true,
      'ip_address'  => '203.192.1.172',
      'card' => $formData


    ])->send();

Replace Above with the code below (note:->purchase(array( NOT ->purchase([

$response = $gateway->purchase(array(
      'email'       => 'customer@customer.com.au',
      'description' => 'Widgets',
      'amount'      => '49.99',
      'currency'    => 'USD',
      'card_token'  => 'card_nytGw7koRg23EEp9NTmz9w',
      'testMode'    => true,
      'ip_address'  => '203.192.1.172',
      'card' => $formData


    ))->send();
user30899
  • 27
  • 6
  • oh and also dont forget to add all billing fields to the card object. – user30899 Dec 14 '13 at 00:17
  • Use var_dump($response) to get the full output. There is also a list of errors in the JSON returned by Pin, so you should see this output in the $response object. – Nigel Sheridan-Smith Dec 23 '14 at 02:13
  • If the only difference is you changed `[]` to `array()`, that's nothing to do with Omnipay - it just means you're running PHP 5.3 or lower, since the short array syntax was [introduced in PHP 5.4](http://php.net/manual/en/migration54.new-features.php). – Leith Jan 23 '18 at 20:42
0

For me, the error: "One or more parameters were missing or invalid" was simply caused by not having two words for the card holder name when testing.

Hayden Thring
  • 1,718
  • 17
  • 25