Comments (2)
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber($card);
$creditCard->setExpirationDate($ex_date);
$creditCard->setCardCode($cvv); // add in
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);
// Set the customer's identifying information
$customerData = new AnetAPI\CustomerDataType();
$customerData->setType("individual");
$customerData->setEmail($email);
// Order info
$order = new AnetAPI\OrderType();
$order->setInvoiceNumber($invoice_num);
$order->setDescription($description);
// Set the customer's Bill To address add this section in
$customerAddress = new AnetAPI\CustomerAddressType();
$customerAddress->setFirstName($name);
$customerAddress->setAddress($street);
$customerAddress->setCity($city);
$customerAddress->setState($state);
$customerAddress->setZip($zip);
$customerAddress->setCountry("USA");
// end of customer billing info code
// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount($amount);
$transactionRequestType->setOrder($order); // add in
$transactionRequestType->setCustomer($customerData); // add in
$transactionRequestType->setBillTo($customerAddress); // add in
$transactionRequestType->setPayment($paymentOne);
$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::PRODUCTION);
// ***************************************************************************
// ***************************************************************************
if ($response != null) {
$tresponse = $response->getTransactionResponse();
if (($tresponse != null) && ($tresponse->getResponseCode() == "1")) {
header("Location: ../admin/payment.php?m=1&id=" . $_GET["id"]);
die();
} else {
header("Location: ../admin/payment.php?m=2&id=" . $_GET["id"]);
die();
}
} else {
header("Location: ../admin/payment.php?m=2&id=" . $_GET["id"]);
die();
}
from sdk-php.
Related Issues (20)
- response types incorrect in 2.0.2 HOT 1
- Response class (file) does not exist. HOT 3
- getTransId() not returning expected result
- Need guide about fixing " Posts Are Returning 404 Errors" HOT 1
- TLS Issues with AWS HOT 2
- How to send extra options in charge Customer Profile? I want to send x_duplicate_window=0 in my function which is charging saved profile.
- Proxy server setting for SDK
- net\authorize\api\contract\v1\CreateCustomerProfileFromTransactionResponse does not exist HOT 3
- authorize SDK and PHP74 compatibility warnings and errors from PHP_CodeSniffer-3.6.1 and PHPCompatibility-9.3.5 HOT 1
- E00007:User authentication failed due to invalid authentication values. HOT 1
- Sdk
- jsonSerialize missing return type messages in PHP 8.1 HOT 3
- CreateTransactionController returns null, conflicting examples HOT 3
- After upgrading from 1.9.9 to ^2.x having "className" not found during the class mapping
- AnetApiSchema.xsd.xml
- Error when scanning package for php 8.1 compatibility
- Incorrect responseType in CreateCustomerProfileFromTransactionController HOT 4
- Deprecated: Return type of net\authorize\api\contract\v1\MerchantAuthenticationType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/html/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php on line 261 HOT 25
- No 8.1 support in 2023 is actually insane. HOT 40
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk-php.