<?php require 'vendor/autoload.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define("AUTHORIZENET_LOG_FILE", "phplog"); // Common setup for API credentials (with PayPal compatible merchant credentials) $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName("5KP3u95bQpv"); $merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S"); $payPalType = new AnetAPI\PayPalType(); $payPalType->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262"); $payPalType->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262"); $paymentOne = new AnetAPI\PaymentType(); $paymentOne->setPayPal($payPalType); // Create an authorize and capture transaction $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureTransaction"); $transactionRequestType->setPayment($paymentOne); $transactionRequestType->setAmount(151); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setTransactionRequest($transactionRequestType); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { $tresponse = $response->getTransactionResponse(); if ($tresponse != null) { echo "Received response code: " . $tresponse->getResponseCode() . "\n"; //Valid response codes: 1=Approved, 2=Declined, 3=Error, 5=Need Payer Consent echo "Secure acceptance URL: " . $tresponse->getSecureAcceptance()->getSecureAcceptanceUrl() . "\n";
<?php require 'vendor/autoload.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define("AUTHORIZENET_LOG_FILE", "phplog"); echo "PayPal Authorize Only Continue Transaction\n"; // Common setup for API credentials $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName("5KP3u95bQpv"); $merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S"); $refId = 'ref' . time(); $paypal_type = new AnetAPI\PayPalType(); $paypal_type->setPayerID("JJLRRB29QC7RU"); $paypal_type->setSuccessUrl("http://www.merchanteCommerceSite.com/Success/TC25262"); $paypal_type->setCancelUrl("http://www.merchanteCommerceSite.com/Success/TC25262"); $payment_type = new AnetAPI\PaymentType(); $payment_type->setPayPal($paypal_type); //create a transaction $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType->setTransactionType("authOnlyContinueTransaction"); $transactionRequestType->setRefTransId("2241711631"); $transactionRequestType->setAmount(125.34); $transactionRequestType->setPayment($payment_type); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setTransactionRequest($transactionRequestType); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) {
<?php require 'vendor/autoload.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define("AUTHORIZENET_LOG_FILE", "phplog"); // Put the values of the Payer ID and Ref. Transaction ID generated in Authorization and Capture $payerID = "6ZSCSYG33VP8Q"; $refTransId = "2241708986"; // Common setup for API credentials (with PayPal compatible merchant credentials) $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName("5KP3u95bQpv"); $merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S"); $payPalType = new AnetAPI\PayPalType(); $payPalType->setPayerID($payerID); $paymentOne = new AnetAPI\PaymentType(); $paymentOne->setPayPal($payPalType); // Create an authorize and capture continue transaction $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureContinueTransaction"); $transactionRequestType->setPayment($paymentOne); $transactionRequestType->setRefTransId($refTransId); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setTransactionRequest($transactionRequestType); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { $tresponse = $response->getTransactionResponse(); if ($tresponse != null) { echo "Transaction Response...\n";
<?php require 'vendor/autoload.php'; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define("AUTHORIZENET_LOG_FILE", "phplog"); // Common setup for API credentials $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName("5KP3u95bQpv"); $merchantAuthentication->setTransactionKey("4Ktq966gC55GAX7S"); $refId = 'ref' . time(); $payPalType = new AnetAPI\PayPalType(); $payPalType->setSuccessUrl(""); $payPalType->setCancelUrl(""); $paymentType = new AnetAPI\PaymentType(); $paymentType->setPayPal($payPalType); $transactionRequest = new AnetAPI\TransactionRequestType(); $transactionRequest->setTransactionType("voidTransaction"); $transactionRequest->setPayment($paymentType); $transactionRequest->setRefTransId(2241706281); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId($refId); $request->setTransactionRequest($transactionRequest); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); if ($response != null) { $tresponse = $response->getTransactionResponse(); if ($tresponse != null && $tresponse->getResponseCode() == "1") { echo "Void transaction SUCCESS TRANS ID : " . $tresponse->getTransId() . "\n"; } else {