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

そして、これは私が得るエラーです: One or more parameters was missing or invalid

任意の助けをいただければ幸いです:)

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 に答える