Skip to content

Instantly share code, notes, and snippets.

@iDavidMorales
Last active August 24, 2018 22:03
Show Gist options
  • Save iDavidMorales/4b54c9d2a485338f126d9fb75755c2bc to your computer and use it in GitHub Desktop.
Save iDavidMorales/4b54c9d2a485338f126d9fb75755c2bc to your computer and use it in GitHub Desktop.
<?
header('Access-Control-Allow-Origin: *');
//require_once("lib/Conekta.php");
require_once("conekta-php/lib/Conekta.php"); //4.0.0
\Conekta\Conekta::setApiKey("key_wCompRCWsQmjFvNNWgGryQ");
\Conekta\Conekta::setApiVersion("2.0.0"); //API 2.0.0
//$token_id=$_POST['token'];
try{
$order = \Conekta\Order::create(array(
'currency' => 'MXN',
'customer_info' => array(
'customer_id' => 'cus_2j9UbTbPwVANCprzg',
'antifraud_info' => array(
'paid_transactions' => 4
)
)
'line_items' => array(
array(
'name' => 'Pago de Servicios de Transporte',
'unit_price' => 35000,
'quantity' => 1,
'antifraud_info' => array(
'trip_id' => '123456',
'driver_id' => 'driv_11231',
'ticket_class' => 'economic',
'pickup_latlon' => '23.4323456,-123.1234567',
'dropoff_latlon' => '23.4323456,-123.1234567'
)
)
),
'charges' => array(
array(
'payment_method' => array(
'type' => 'default'
)
)
)
));
} catch (\Conekta\ProcessingError $error){
echo $error->getMessage();
} catch (\Conekta\ParameterValidationError $error){
echo $error->getMessage();
} catch (\Conekta\Handler $error){
echo $error->getMessage();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment