$cartItem->name = "ItemTeste"; $cartItem->quantity = 1; $cartItem->sku = "201411170235134521346"; $cartItem->unitPrice = 123; $cartItem->risk = "High"; // Nível do risco do produto. $cartItem->timeHedge = "Normal"; $cartItem->type = "AdultContent"; $cartItem->velocityHedge = "High"; $cartItem->passenger = $passenger; array_push($cartItems, $cartItem); $cart->items = $cartItems; $fraudAnalysis->browser = $browser; $fraudAnalysis->cart = $cart; $sale->payment->fraudAnalysis = $fraudAnalysis; $api = new BraspagApiServices(); $result = $api->createSale($sale); if (is_a($result, 'BraspagSale')) { /* * In this case, you made a succesful call to API and receive a Sale object in response */ echo "<ul><li><a href=\"example_credit_capture.php?paymentId={$sale->payment->paymentId}\" target=\"_blank\">Capture Card</a></li>"; echo "<li><a href=\"example_credit_void.php?paymentId={$sale->payment->paymentId}\" target=\"_blank\">Void Card</a></li>"; echo "<li><a href=\"example_all_get.php?paymentId={$sale->payment->paymentId}\" target=\"_blank\">Get Card</a></li></ul>"; BraspagUtils::debug($sale, "Card Success!"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ BraspagUtils::debug($result, "Bad Request Auth!"); } else {
<?php header('Content-Type: text/html; charset=utf-8'); include $_SERVER['DOCUMENT_ROOT'] . "/src/BraspagApiIncludes.php"; $paymentId = $_GET['paymentId']; $captureRequest = new BraspagCaptureRequest(); $captureRequest->amount = 1500; $api = new BraspagApiServices(); $result = $api->capture($paymentId, $captureRequest); if (is_a($result, 'BraspagCaptureResponse')) { /* * In this case, you made a succesful call to API and receive a CaptureResponse object in response */ BraspagUtils::debug($sale, "Capture Response Succesful!"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ BraspagUtils::debug($result, "Bad Request:"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized */ BraspagUtils::debug($result, "HTTP Status Code:"); }
<?php header('Content-Type: text/html; charset=utf-8'); include $_SERVER['DOCUMENT_ROOT'] . "/src/BraspagApiIncludes.php"; $paymentId = $_GET['paymentId']; $voidAmount = 1500; $api = new BraspagApiServices(); $result = $api->void($paymentId, $voidAmount); if (is_a($result, 'BraspagVoidResponse')) { /* * In this case, you made a succesful call to API and receive a VoidResponse object in response */ BraspagUtils::debug($result, "Void Response succesful:"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ BraspagUtils::debug($result, "Bad Request:"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized */ BraspagUtils::debug($result, "HTTP Status Code:"); }
<?php header('Content-Type: text/html; charset=utf-8'); include $_SERVER['DOCUMENT_ROOT'] . "/src/BraspagApiIncludes.php"; $paymentId = $_GET['paymentId']; $voidAmount = 1500; $api = new BraspagApiServices(); $result = $api->Void($paymentId, $voidAmount); if (is_a($result, 'BraspagVoidResponse')) { /* * In this case, you made a succesful call to API and receive a VoidResponse object in response */ $api->debug($result, "Void Response succesful:"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ $api->debug($result, "Bad Request:"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized */ $api->debug($result, "HTTP Status Code:"); }
$payment->provider = "Simulado"; $payment->installments = 3; $card = new BraspagCard(); $card->brand = "Visa"; $card->cardNumber = "4532117080573700"; $card->expirationDate = "12/2015"; $card->holder = "Test T S Testando"; $card->securityCode = "000"; $payment->creditCard = $card; $recurrent = new BraspagRecurrentPayment(); $recurrent->authorizeNow = true; $recurrent->endDate = "2020-08-01"; $recurrent->interval = "Monthly"; $payment->recurrentPayment = $recurrent; $sale->payment = $payment; $api = new BraspagApiServices(); $result = $api->CreateSale($sale); if (is_a($result, 'BraspagSale')) { /* * In this case, you made a succesful call to API and receive a Sale object in response */ echo "<li><a href=\"example_all_get.php?paymentId={$sale->payment->paymentId}\" target=\"_blank\">Get Card</a></li></ul>"; $api->debug($sale, "Card Recurrent Success!"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ $api->debug($result, "Bad Request Auth!"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized
$address->city = "Rio de Janeiro"; $address->complement = "Sala 934"; $address->country = "BRA"; $address->district = "Centro"; $address->number = "160"; $address->state = "RJ"; $address->street = "Av. Marechal Câmara"; $address->zipCode = "20020-080"; $customer->address = $address; $sale->customer = $customer; $payment = new BraspagEletronicTransferPayment(); $payment->amount = 15900; $payment->provider = "Bradesco"; $payment->returnUrl = "http://www.braspag.com.br"; $sale->payment = $payment; $api = new BraspagApiServices(); $result = $api->CreateSale($sale); if (is_a($result, 'BraspagSale')) { /* * In this case, you made a succesful call to API and receive a Sale object in response */ echo "<li><a href=\"example_all_get.php?paymentId={$sale->payment->paymentId}\" target=\"_blank\">Get EletronicTransfer</a></li></ul>"; $api->debug($sale, "Eletronic Transfer Success!"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ $api->debug($result, "Bad Request Auth!"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized
<?php header('Content-Type: text/html; charset=utf-8'); include $_SERVER['DOCUMENT_ROOT'] . "/src/BraspagApiIncludes.php"; $paymentId = $_GET['paymentId']; $api = new BraspagApiServices(); $result = $api->get($paymentId); if (is_a($result, 'BraspagSale')) { /* * In this case, you made a succesful call to API and receive a Sale object in response */ BraspagUtils::debug($result, 'Success:'); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ BraspagUtils::debug($result, 'Bad Request:'); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized */ BraspagUtils::debug($result, 'HTTP Status Code:'); }
<?php header('Content-Type: text/html; charset=utf-8'); include $_SERVER['DOCUMENT_ROOT'] . "/src/BraspagApiIncludes.php"; $paymentId = $_GET['paymentId']; $captureRequest = new BraspagCaptureRequest(); $captureRequest->amount = 1500; $api = new BraspagApiServices(); $result = $api->Capture($paymentId, $captureRequest); if (is_a($result, 'BraspagCaptureResponse')) { /* * In this case, you made a succesful call to API and receive a CaptureResponse object in response */ $api->debug($sale, "Capture Response Succesful!"); } elseif (is_array($result)) { /* * In this case, you made a Bad Request and receive a collection with all errors */ $api->debug($result, "Bad Request:"); } else { /* * In this case, you received other error, such as Forbidden or Unauthorized */ $api->debug($result, "HTTP Status Code:"); }