【问题标题】:Omni Pay - Pin Payments Generic errorOmni Pay - Pin 付款一般错误
【发布时间】:2013-12-31 16:48:35
【问题描述】:

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

我正在尝试让 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();
?>

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

任何帮助表示赞赏:)

【问题讨论】:

  • 从文档来看,您的 $formData 数组中缺少 CVV:github.com/omnipay/omnipay
  • 他 Scrowler ,谢谢你的回复,我已经在CVV中添加了。没有它,代码就可以工作,因为我没有从服务器收到任何关于 CVV 的消息。
  • 您是否从 OmniPay 或 Pin Payments 收到该错误?
  • 错误来自密码支付
  • 试试var_dump($response-&gt;getData()) - 你能看到更具体的错误信息吗?

标签: php omnipay


【解决方案1】:

问题已解决:

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

【讨论】:

  • 哦,别忘了将所有账单字段添加到卡对象中。
  • 使用 var_dump($response) 获取完整输出。 Pin 返回的 JSON 中还有一个错误列表,因此您应该在 $response 对象中看到此输出。
  • 如果唯一的区别是您将 [] 更改为 array(),这与 Omnipay 无关 - 这仅表示您运行的是 PHP 5.3 或更低版本,因为短数组语法为 @987654321 @.
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2018-12-31
    • 2023-02-12
    • 2014-12-19
    • 1970-01-01
    • 2017-05-13
    • 1970-01-01
    • 2017-11-24
    • 2016-05-14
    • 1970-01-01
    相关资源
    最近更新 更多