Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require_once("lib/veritrans/Veritrans.php");
- // Veritrans Server Key
- Veritrans_Config::$serverKey = "<your-server-key>";
- // Uncomment for production environment
- Veritrans_Config::$isProduction = true;
- // Uncomment to enable sanitization
- // Veritrans_Config::$isSanitized = true;
- // Uncomment to enable 3D-Secure
- Veritrans_Config::$is3ds = true;
- // Added Ongkir and Taxes if available
- $Ongkir = array(array(
- "id" => rand(),
- "price" => "15000",
- "quantity" => "1",
- "name" => "ONGKIR YES JKT"
- ));
- $Taxes = array(array(
- "id" => rand(),
- "price" => "15000",
- "quantity" => "1",
- "name" => "PAJAK 15%"
- ));
- // TODO Insert database
- foreach ($_SESSION["shoppingcart"] as $i => $value){ // If wanna use cookies, please use $_COOKIES["whatisyourcart"]
- $varCart [$i] = array(
- "id" => $_SESSION["shoppingcart"][$i]["id"],
- "price" => $_SESSION["shoppingcart"][$i]["price"],
- "quantity" => $_SESSION["shoppingcart"][$i]["quantity"],
- "name" => $_SESSION["shoppingcart"][$i]["name"]
- );
- $items = array_merge($varCart, $Ongkir, $Taxes);
- }
- // Setup Parameters
- $params = array(
- 'transaction_details' => array(
- 'order_id' => rand(),
- 'gross_amount' => "50000",
- ),
- "item_details" => ($items),
- "customer_details" => array (
- "first_name" => "Sterli",
- "last_name" => "Snax",
- "email" => "saya@sterli.net",
- "phone" => "08176460388",
- "billing_address" => array (
- "first_name" => "Sterli",
- "last_name" => "Snax",
- "address" => "Jl. Kembang II No. 17",
- "city" => "Jakarta Pusat",
- "postal_code" => "10000",
- "phone" => "08176460388",
- "country_code" => "IDN"
- ),
- "shipping_address" => array(
- "first_name" => "Sterli",
- "last_name" => "Snax",
- "address" => "Jl. Gunung Sahari Raya No. 2, Ruko Marina Tama, Blok B/11",
- "city" => "Jakarta Pusat",
- "postal_code" => "10000",
- "phone" => "02164002000",
- "country_code" => "IDN"
- )
- ) // <---customer_details array;
- ); // <--- Params Array
- /* For debug only
- echo "<pre>";
- print_r($params);
- echo "</pre>";
- */
- /*♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫ After All This Time by Simon Webbe ♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫♫ */
- try {
- // Redirect to Veritrans VTWeb page
- header('Location: ' . Veritrans_Vtweb::getRedirectionUrl($params));
- }
- catch (Exception $e) {
- echo $e->getMessage();
- }
Add Comment
Please, Sign In to add comment