Last active
August 24, 2018 22:02
-
-
Save iDavidMorales/85849ef8cbe053b9f5190729081d0061 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
header('Access-Control-Allow-Origin: *'); | |
//require_once("lib/Conekta.php"); | |
require_once("conekta-php/lib/Conekta.php"); //4.0.4 | |
\Conekta\Conekta::setApiKey("key_XXXXXXXX"); | |
\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' => 10000, | |
'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