2017-10-30 7 views
0

는 내가 PayFort 지불 게이트웨이를 사용하여 지불을 추가하려고하지만,이 오류 메시지와 함께 실패합니다PayFort 지불 게이트웨이를 사용하여 지불하는 방법은 무엇입니까?

요금이 처리되지 않은 요청 PARAMS이 유효하지 않습니다.

내 코드를보고 그것을 위해 어떤 지침이나 제안을하시기 바랍니다 :

$api_keys = array(
    "secret_key" => "test_sec_k_965cd1f7f333f998c907b", 
    "open_key" => "test_open_k_d6830e5f0f276ebb9046" 
); 

/* convert 10.00 AED to cents */ 
$amount_in_cents = 10.00 * 100; 
$currency = "AED"; 
$customer_email = "[email protected]"; 

Start::setApiKey($api_keys["secret_key"]); 

try { 
    $charge = Start_Charge::create(array(
     "amount"  => $amount_in_cents, 
     "currency" => $currency, 
     "card"  => '4242424242424242', 
     "email"  => '[email protected]', 
     "ip"   => $_SERVER["REMOTE_ADDR"], 
     "description" => "Charge Description" 
    )); 

    echo "<h1>Successfully charged 10.00 AED</h1>"; 
    echo "<p>Charge ID: ".$charge["id"]."</p>"; 
    echo "<p>Charge State: ".$charge["state"]."</p>"; 
    die; 
} catch (Start_Error $e) { 
    $error_code = $e->getErrorCode(); 
    $error_message = $e->getMessage(); 

    if ($error_code === "card_declined") { 
     echo "<h1>Charge was declined</h1>"; 
    } else { 
     echo "<h1>Charge was not processed</h1>"; 
    } 

    echo "<p>".$error_message."</p>"; 
    die; 
} 

답변

0

내가 대답을 발견

Start::setApiKey($sadad_detail["open_key"]); //Important 

$token = Start_Token::create(array(
     "number" => $this->input->post("card-number"), 
     "exp_month" => $this->input->post("expiry-month"), 
     "exp_year" => $this->input->post("expiry-year"), 
     "cvc" => $this->input->post("card-cvv"), 
     "name" => $this->input->post("card-holder-name") 
    )); 
    //echo "<pre>"; print_r($token); echo '</pre>'; 

Start::setApiKey($sadad_detail["secret_key"]); //Important 

$currency = getCustomConfigItem('currency_code'); 

$charge = Start_Charge::create(array(
    "amount"  => (int)200, 
    "currency" => $currency, 
    "card"  => $token['id'], 
    "email"  => '[email protected]', 
    "ip"   => $_SERVER["REMOTE_ADDR"], 
    "description" => "Charge Description" 
)); 

만들기 토큰 최초의 "open_key"을 사용하여 "SECRET_KEY"을 사용하여 충전을 시작합니다 . 괜찮습니다. 모두에게 감사드립니다.