$amount,
// 'currency' => "EUR",
// 'paymentForms' => array(
// "paymentMethodType" => "CARD",
// "pan" => "4970100000000055",
// "expiryMonth" => "11",
// "expiryYear" => "21",
// "securityCode" => "123"
// )
// );
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, "https://api.lyra.com/api-payment/V4/Charge/CreatePayment");
// curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
// curl_setopt($ch, CURLOPT_POST, 1);
// curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postdata));
// curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Authorization: Bearer ' . $token));
// $response = curl_exec($ch);
// if (isset($debug[1]) && $debug[1] == '1' ) $debugMsg .=$response;
// curl_close($ch);
// ---------------------------------------------------
// I initialize the PHP SDK
// ---------------------------------------------------
// require_once 'vendor/autoload.php';
// require_once __DIR__ . '/keys.php';
// require_once __DIR__ . '/helpers.php';
// ---------------------------------------------------
// Initialize the SDK
// see keys.php
$client = new Lyra\Client();
// ---------------------------------------------------
// I create a formToken
// ---------------------------------------------------
$store = array("amount" => 250,
"currency" => "EUR",
// "orderId" => uniqid("MyOrderId"),
"customer" => array(
"email" => $idMail
));
$response = $client->post("V4/Charge/CreatePayment", $store);
/* I check if there are some errors */
if ($response['status'] != 'SUCCESS') {
/* an error occurs, I throw an exception */
display_error($response);
$error = $response['answer'];
throw new Exception("error " . $error['errorCode'] . ": " . $error['errorMessage'] );
}
if (isset($debug[1]) && $debug[1] == '1' ) $debugMsg .='response =
' .$response;
/* everything is fine, I extract the formToken */
$formToken = $response["answer"]["formToken"];
// $client = $response["answer"]["customer"];
if (isset($debug[1]) && $debug[1] == '1' ) $debugMsg .='FormToken =
' .$formToken;
?>