2

您知道通用错误消息没有多大帮助。

我正在尝试让 Omnipay 与 Pin Payments 一起使用。

这是我到目前为止所拥有的:

    <?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();
?>

这是我得到的错误:一个或多个参数丢失或无效

任何帮助表示赞赏:)

4

2 回答 2

0

问题解决了:

$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();

将上面的代码替换为下面的代码(注意:->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();
于 2013-12-13T23:41:30.237 回答
0

对我来说,错误:“一个或多个参数丢失或无效”仅仅是由于测试时持卡人姓名没有两个单词造成的。

于 2020-11-04T02:13:36.197 回答