Q:

How to do payment using PayFort payment gateway?

I am trying to add a payment using the PayFort payment gateway, but it fails with this error message:

Charge was not processed Request params are invalid.

Please see my code and give any instructions or suggestions for it:
$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 = "myMailId@gmail.com";

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

try {
    $charge = Start_Charge::create(array(
        "amount"      => $amount_in_cents,
        "currency"    => $currency,
        "card"        => '4242424242424242',
        "email"       => 'myMailId2@gmail.com',
        "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;
}

A:

I found answer 
 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"       => 'test@gmail.com',
   "ip"          => $_SERVER["REMOTE_ADDR"],
   "description" => "Charge Description"
));

Create token first using "open_key" and start charge using "secret_key".
It's work fine. Thanks all.

