authorizenet / sample-code-php Goto Github PK
View Code? Open in Web Editor NEWThis repository contains working code samples which demonstrate php integration with the Authorize.Net API
License: MIT License
This repository contains working code samples which demonstrate php integration with the Authorize.Net API
License: MIT License
I tried to make a payment via authorize.net payment (using visa card)
It's error E00027: The transaction was unsuccessfully
I used production mode. (development mode worked normally).
I have already compared to sample code:
在RecurringBilling/get-list-of-subscriptions.php
文件中,使用了如下代码:
$sorting = new AnetAPI\ARBGetSubscriptionListSortingType();
$sorting->setOrderBy("id");
$sorting->setOrderDescending("false");
但是实际上 setOrderDescending
接受的参数应该为 true
或者 false
;
看意图是不进行倒序排列,但是如果传递"false"
参数是为 true
的,是倒序排列的,这会带来困惑。
Warning: file_put_contents(phplog): failed to open stream: Permission denied in /var/www/vhosts/mydomain.com/httpdocs/library/anetsdk/lib/net/authorize/util/Log.php on line 269
I have the define("AUTHORIZENET_LOG_FILE","phplog"); line ahead of the 'use' statements for including the namespaces for authorize.net for contract and controller.
I still get the error outputting lots of times ahead of the executeWithApiResposne() function call.
WHERE do I assign the phplog value so this function has something to use rather than generating warnings?
I have known that ,for now, I can only get customerPaymentProfileList by sorting the cardExpireDate. But I need to get all paymentProfileIDs for a certain customer, only using customerID.
Have contributors add more searchType such as customer_Id ?
Or is there another way to do it ?
Thanks
He Zhao
It's not clear how I can adjust someone's subscription on my site with update-subscription.php.
The price a user pays on my site is dynamic and according to the number of emails they plan to send per month. Sometimes, they need to send more or downgrade their account meaning I need to adjust their monthly subscription accordingly. The update-subscription.php provides no way of modifying the amount or the billing cycle. Any help?
On your API page, you describe that authorization and capture is possible.
http://developer.authorize.net/api/reference/#payment-transactions-charge-a-credit-card
Use this method to authorize and capture a credit card payment.
However, using our live credentials... we notice that we need to manually capture on the authorize.net backend.
This is from your support team
"You'll want to let your web or software provider know that the transactions aren't always being automatically captured. It's up to them to ensure that the transaction request that's sent to us includes a request to capture. We can't automatically capture without that request."
What is the point of this code if it doesn't automatically "authorize and capture" a user's credit card when they purchase? https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/charge-credit-card.php
What more do we need to do beyond what is in the above link?
Thank you for your hard work on this sample PHP code library!
There is a function createCustomerProfileTransaction
used in the SDK-PHP test suite. However, I am not seeing the function createCustomerProfileTransaction
used anywhere in this sample-code-php library.
Would you be able to add a sample that included this function?
Thank you for considering,
Ryan
when trying to send authorization and capture request
can not change my price - its always the same amount ,
what other variable can I change to avoid getting this error ?
How do I get the payment profile ID out of ARBGetSubscriptionRequest using the PHP SDK?
It's not shown in the sample listed at https://github.com/AuthorizeNet/sample-code-php/blob/master/RecurringBilling/get-subscription.php
After createCustomerProfileFromTransaction is there an easy way to determine which CustomerPaymentProfileId was just used/set?
It's easy to $response->getCustomerProfileId() and I see a getCustomerPaymentProfileIdList() method, but not sure if I have to loop through that and compare with transaction data just transmitted or if there's a better way.
Hi guys,
Thanks for this awesome samples, really helpful.
I’m trying to pass the name on the card to the API but I’m not sure how to do. I figured out there was a BillTo field with name in the API requests parameters but I’m not able to find it in the PHP SDK.
So far my piece of code is very similar to the original example:
`
// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($this->ci->config->item('AUTHNETAPILOGINID'));
$merchantAuthentication->setTransactionKey($this->ci->config->item('AUTHNETKEY'));
$refId = 'ref' . time();
// Remove potential white spaces
$ccn = preg_replace('/\s+/', '', $ccn);
// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber( intval( $ccn ) );
$creditCard->setExpirationDate( $exp );
$creditCard->setCardCode( $cvc );
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);
$order = new AnetAPI\OrderType();
$order->setDescription("Ticket");
// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount( $amount );
$transactionRequestType->setOrder( $order );
$transactionRequestType->setPayment($paymentOne);
$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId( $refId );
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);
$response_api = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);
if ($response_api != null)
{
// More Code
}
`
Hello, how I create a invoice (like this https://www.authorize.net/solutions/merchantsolutions/merchantservices/invoicing/) with API in PHP?.
Thanks,
When I run refund-transaction.php. I got an following error
Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found in /opt/lampp/htdocs/payment/vendor/jms/serializer/src/JMS/Serializer/Metadata/Driver/YamlDriver.php on line 35
Please hands to me
Hello support.
I am trying to use your sample code on refund, but it is not working.
This is my code.
public function refund($transaction_id)
{
$refundRequest = new RefundTransactionRequestType();
$refundRequest->RefundType = 'FULL';
$refundRequest->TransactionID = $transaction_id;
$refundReq = new RefundTransactionReq();
$refundReq->RefundTransactionRequest = $refundRequest;
try
{
/* wrap API method calls on the service object with a try catch */
$refundResponse = $this->get_paypal_service()->RefundTransaction($refundReq);
if(isset($refundResponse) && strtolower($refundResponse->Ack) == 'success' )
{
return true;
}
} catch (Exception $ex) {
log_message('error', 'Error when refunding the client for transaction #' . $transaction_id . ' ' . $ex->getMessage());
}
return false;
}
public function get_paypal_service()
{
\PayPal\Core\PPHttpConfig::$DEFAULT_CURL_OPTS[CURLOPT_SSLVERSION] = 1;
$config = array(
"acct1.UserName" => "xx",
"acct1.Password" => "xx,
"acct1.Signature" => "xxxxxxxxxx",
"acct1.CertPath" => APPPATH . "librairies/cert_key.pem",
"log.FileName" => APPPATH . "logs/paypal.log",
"mode" => "sandbox",
"log.LogEnabled" => true,
"validation.level" => "log",
"log.LogLevel" => "INFO",
);
$wrapper = new PayPalAPIInterfaceServiceService( $config );
return $wrapper;
}
Another api is working, it means there is no issue on account info and system. But right now refund function says 400 error. Let me know why this happens. I need your help.
When I call createCustomerProfileFromTransaction($transactionId) I get E00059 The authentication type is not allowed for this method call. Does anyone know the cause of this? I'm sending to the SANDBOX server.
has anyone else tried creating an account on developer.authorize.net? i have created 4 different accounts, on two different computer, both with and without 3rd party cookies. it always appears to succeed, and i get sandbox login ID and key. BUT, the credentials don't work and i can never log into the sandbox account.
yet another obstacle to working with authorize.net.
I'm having a hard time following the sample SDK code for parsing responses. All the sample code uses this line after constructing a controller and executing a response:
<?php
$response = $controller->executeWithApiResponse(
\net\authorize\api\constants\ANetEnvironment::SANDBOX
);
$tresponse = $response->getTransactionResponse();
The getTransactionResponse
method does not exist in the method. I was expecting to see a __call()
method that reflects the method name and accesses the corresponding property, or a class being extended where this method was present, but I didn't find anything.
Is there some php magic here that I'm missing? I would really love to know how this ticks. It's hard to use an SDK with methods that aren't enumerated in the code!
No string message was returned with error response:
object(net\authorize\api\contract\v1\TransactionResponseType)[3211]
private 'responseCode' => string '3' (length=1)
private 'rawResponseCode' => null
private 'authCode' => string '' (length=0)
private 'avsResultCode' => string 'P' (length=1)
private 'cvvResultCode' => string '' (length=0)
private 'cavvResultCode' => string '' (length=0)
private 'transId' => string '0' (length=1)
private 'refTransID' => string '' (length=0)
private 'transHash' => string '47E5203FA27E51E971221406BB284BDC' (length=32)
private 'testRequest' => string '0' (length=1)
private 'accountNumber' => string 'XXXX6456' (length=8)
private 'entryMode' => null
private 'accountType' => string '' (length=0)
private 'splitTenderId' => null
private 'prePaidCard' => null
private 'messages' =>
array (size=0)
empty
private 'errors' =>
array (size=1)
0 =>
object(net\authorize\api\contract\v1\TransactionResponseType\ErrorsAType\ErrorAType)[3194]
...
private 'splitTenderPayments' =>
array (size=0)
empty
private 'userFields' =>
array (size=0)
empty
private 'shipTo' => null
private 'secureAcceptance' => null
private 'emvResponse' => null
private 'transHashSha2' => string '' (length=0)
private 'profileResponse' => null
private 'refId' (net\authorize\api\contract\v1\ANetApiResponseType) => null
private 'messages' (net\authorize\api\contract\v1\ANetApiResponseType) =>
object(net\authorize\api\contract\v1\MessagesType)[3175]
private 'resultCode' => string 'Error' (length=5)
private 'message' =>
array (size=1)
0 =>
object(net\authorize\api\contract\v1\MessagesType\MessageAType)[3190]
Hello,
I got the following php error while running authoriz.net\sample-code-php-master\PaymentTransactions/refund-transaction.php code.
Warning: require(C:\xampp\htdocs/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\croppic-master\refund-transaction.php on line 2
How can set billing info, customer info and product info etc. other details during Authorization Only, Continued.
Hello,
I don't know if you've already tested ARBCreateSubscriptionRequest with customer profile ID. Apparently it seems not working even here http://developer.authorize.net/api/reference/index.html#recurring-billing-create-a-subscription-from-customer-profile
When you send this request with customer profile ID:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>api login id</name>
<transactionKey>transaction key</transactionKey>
</merchantAuthentication>
<refId>Sample</refId>
<subscription>
<name>Sample subscription</name>
<paymentSchedule>
<interval>
<length>1</length>
<unit>months</unit>
</interval>
<startDate>2020-08-30</startDate>
<totalOccurrences>12</totalOccurrences>
<trialOccurrences>1</trialOccurrences>
</paymentSchedule>
<amount>10.29</amount>
<trialAmount>0.00</trialAmount>
<profile>
<customerProfileId>1807263780</customerProfileId>
<customerPaymentProfileId>1802291213</customerPaymentProfileId>
</profile>
</subscription>
</ARBCreateSubscriptionRequest>
it asks for Billing first and last names:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<refId>
Sample
</refId>
<messages>
<resultCode>
Error
</resultCode>
<message>
<code>
E00014
</code>
<text>
Bill-To First Name is required.
</text>
</message>
<message>
<code>
E00014
</code>
<text>
Bill-To Last Name is required.
</text>
</message>
</messages>
</ARBCreateSubscriptionResponse>
and when you set the billing first and last names:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>api login id</name>
<transactionKey>transaction key</transactionKey>
</merchantAuthentication>
<refId>Sample</refId>
<subscription>
<name>Sample subscription</name>
<paymentSchedule>
<interval>
<length>1</length>
<unit>months</unit>
</interval>
<startDate>2020-08-30</startDate>
<totalOccurrences>12</totalOccurrences>
<trialOccurrences>1</trialOccurrences>
</paymentSchedule>
<amount>10.29</amount>
<trialAmount>0.00</trialAmount>
<billTo>
<firstName>John</firstName>
<lastName>Smith</lastName>
</billTo>
<profile>
<customerProfileId>39931060</customerProfileId>
<customerPaymentProfileId>36223863</customerPaymentProfileId>
<customerAddressId>37726371</customerAddressId>
</profile>
</subscription>
</ARBCreateSubscriptionRequest>
it says you cannot use both:
<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<refId>
Sample
</refId>
<messages>
<resultCode>
Error
</resultCode>
<message>
<code>
E00093
</code>
<text>
PaymentProfile cannot be sent with billing data.
</text>
</message>
</messages>
</ARBCreateSubscriptionResponse>
But removing the profile node and you're asked for the payment information.
Any idea how to make this work ?
Thanks
I am using sample code from here https://developer.authorize.net/api/reference/index.html#payment-transactions-authorize-a-credit-card. I am using https://github.com/AuthorizeNet/sdk-php/releases and require 'path/to/anet_php_sdk/autoload.php'; since I am not using composer. and I get syntax error, unexpected 'use' (T_USE). on these two lines
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
The sample code here covers only a scenario when a customer profile and a customer payment profile are created.
What if I already have a customer profile id and a customer payment profile id?
How should I use the TransactionRequestType
?
From those ids I'm retrieving the customer profile and the customer profile id (when retrieving that data an instance of *MaskedType
is returned that is useless here), how can I set a customerProfileId and a customerPaymentProfileId in that object?
When I run PaymentTransactions/charge-credit-card.php
in browser I get the following error.
/PaymentTransactions/charge-credit-card.php - require(): Failed opening required 'vendor/autoload.php' (include_path='.:/usr/share/php') in /home/tj/seebiz/authorize.net/sample-code-php/PaymentTransactions/charge-credit-card.php on line 2
This Code (CustomerProfiles->create-customer-payment-profile.php) won't run correctly as there is a typo on line 63. it reads paymentprofile when it should be paymentProfile.
Using code from create-customer-profile.php
the $response->getCustomerShippingAddressIdList()
is empty. That number is required for creating a subscription.
Further, I can't find any other request that will return this ID.
It would appear the billing is being accepted:
Maybe you can show how to create a subscription without hardcoding all the IDs? Thanks!
why didn't find out vendor/autoload.php directory when download sample-code-php pack?
I am using following code for making transaction with my sandbox account which is working fine. But I am unable to pass following parameters :-
I have tested the code on my local computer and it seems to run well. But I get the following error;
Fatal error: Call to undefined function JMS\Serializer\json_decode() in /home/havis2/public_html/authorize/vendor/jms/serializer/src/JMS/Serializer/JsonDeserializationVisitor.php on line 27
when I try to run the code after uploading it to an online server.
My local PHP installation is version 5.6.28 and the one at the server is version 5.6.30.
Here is a screenshot of the active modules at the online server that is running into the error.
Any help would be appreciated.
Hello,
I downloaded this code and trying to use in localhost but i was getting an warning that is "Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\wamp\www\samplemaster\test-runner.php on line 2". So where i can fond this vendore DIR and the file autoload.php.
Hi, is there a function or way to move a payment profile from one customer profile to another, or a way to merge customer profiles?
There are times we erroneously create multiple profiles for the same customer.
I've been looking through the example code to auth & capture a sale on a credit card found here:
PaymentTransactions/charge-credit-card.
The error handling feels fairly clunky and full of potential gotchas. Conditionals get nested up to 4-levels deep, there are weak equality checks against NULL
which behaves in tricky ways (almost like empty()
, but not... see the php docs ), and the error/message arrays are accessed only at index 0 for codes & descriptions (no looped printing of messages? if always a single element in an array, why an array?).
I understand that an auth & capture can have many conditions to a failure, and that this code is meant to show off as much of the inner workings of the SDK as possible, but is there not a way to expose a success variable that isn't deeply nested and conditional? Why can the result code come back 'ok'
, but the transaction still fail?
As I dig deeper into these questions by reviewing your reference docs, I feel like there is a lot that is left out of this example. Just trying to wrap my head around the features and the mechanics of this SDK so I can robustly handle transactions.
Hi,
Requirement:
When ever a subscription transaction is failed due to credit card number changed or any other possibility the customer should receive an email about the issue.
currently merchant is receiving the email, he has to inform the customer. can this process be automated by sending direct email to customer?
Thanks
I am using laravel 5.2 and I cannot run any of the example codes because of the above error.
It looks like nothing else is giving errors except when I get to
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") ) { echo "Succesfully create customer profile : " . $response->getCustomerProfileId() . "\n"; $paymentProfiles = $response->getCustomerPaymentProfileIdList(); echo "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n"; }
`public function createProfile($cardnum, $mm, $yy, $cvc, $email){
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName("xxxxxx");
$merchantAuthentication->setTransactionKey("yyyyyyyyy");
$refId = 'ref' . time();
// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber( "4111111111111111");
$creditCard->setExpirationDate( "2038-12");
$paymentCreditCard = new AnetAPI\PaymentType();
$paymentCreditCard->setCreditCard($creditCard);
// set profile
$billto = new AnetAPI\CustomerAddressType();
$billto->setFirstName("FullName");
$billto->setCompany("Souveniropolis");
// payment profile
$paymentprofile = new AnetAPI\CustomerPaymentProfileType();
$paymentprofile->setCustomerType('individual');
$paymentprofile->setBillTo($billto);
$paymentprofile->setPayment($paymentCreditCard);
$paymentprofiles[] = $paymentprofile;
$customerprofile = new AnetAPI\CustomerProfileType();
$customerprofile->setDescription("Customer 2 Test PHP");
$customerprofile->setMerchantCustomerId("M_".$email);
$customerprofile->setEmail($email);
$customerprofile->setPaymentProfiles($paymentprofiles);
$request = new AnetAPI\CreateCustomerProfileRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId( $refId);
$request->setProfile($customerprofile);
$controller = new AnetController\CreateCustomerProfileController($request);
$response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
if (($response != null) && ($response->getMessages()->getResultCode() == "Ok") )
{
echo "Succesfully create customer profile : " . $response->getCustomerProfileId() . "\n";
$paymentProfiles = $response->getCustomerPaymentProfileIdList();
echo "SUCCESS: PAYMENT PROFILE ID : " . $paymentProfiles[0] . "\n";
}
else
{
echo "ERROR : Invalid response\n";
$errorMessages = $response->getMessages()->getMessage();
echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
}
return $response;
}`
if yes please let me know the location on code snippet ?
Hi there,
Please update the following sample-code-php example to include examples of private function calls needed to create lineItems:
sample-code-php/PaymentTransactions/get-an-accept-payment-page.php
During creation of transaction before requesting a hosted payment page. To add Lineitems to customer order, the private function examples are missing.
["order":"net\authorize\api\contract\v1\TransactionRequestType":private]=> NULL ["lineItems":"net\authorize\api\contract\v1\TransactionRequestType":private]
order->Lineitems is only superficially referenced in API documentation located here:
https://developer.authorize.net/api/reference/index.html#payment-transactions-create-an-accept-payment-transaction
There is only a python sdk example at the moment:
https://community.developer.authorize.net/t5/Integration-and-Testing/Adding-lineItems-in-python-sdk/m-p/59737/highlight/true#M34315
When trying to do the following:
$lineItem1 = array();
$lineItem1["itemId"] = "12345";
$lineItem1["name"] = "first";
$lineItem1["description"] = "Here's the first line item";
$lineItem1["quantity"] = "2";
$lineItem1["unitPrice"] = "7.99";
$lineItems = array();
$lineItems[] = $lineItem1;
$transactionRequestType->setLineItems($lineItems);
API responds with this error:
PHP Fatal error: Call to a member function getItemId() on array
There seems to be private functions designated in API for this purpose but are not documented.
Thank you,
Zeshan
The AuthorizeNet documentation references being able to set includeTransactions property:
[BOOLEAN] Indicates whether to include information about transactions for this subscription.
If set to true, information about the most recent 20 transactions for this subscription will be included in the response.
How is this done with the SDK?
Similar to #280
Thank you
Hi
I downloaded the master branch. When I try to run
sample-code-php/CustomerProfiles/get-customer-payment-profile-list.php
It cant find the CustomerPaymentProfileSortingType Class and I don't see it on the code. Am I doing something wrong?
Thanks!
When running the example here: https://github.com/AuthorizeNet/sample-code-php/blob/master/PaymentTransactions/authorize-credit-card.php
I get the following error:
Fatal error: Uncaught TypeError: Return value of Doctrine\Common\Annotations\AnnotationRegistry::registerFile() must be an instance of Doctrine\Common\Annotations\void, none returned
It looks like you require goetas-webservices/xsd2php-runtime
which then requires jms/serializer
which then uses doctrine/annotations
.
Dotrine/annotations now requires PHP 7.1. Does that mean that your library will only work in PHP 7.1? I upgraded my version to 7.1 and the process did in fact work. Please let me know if all of the info above is correct. Seems like your docs would need to be updated to say 7.1
instead of 5.6
.
Thank You.
Hello,
The new version of SDK requires php 5.5 but our hosting has 5.4.5. It is not possible to migrate to php 5.5 just for one application. So is it possible we can use an older version of sdk ?
I got an idea that older versions can be used.
So I changed the composer.json code to
{
"require": {
"php": ">=5.2.0",
"ext-curl": "*",
"authorizenet/authorizenet": "1.8.1",
"jms/serializer": "xsd2php-dev as 0.18.0"
},
"repositories": [{
"type": "vcs",
"url": "https://github.com/goetas/serializer.git"
}]
}
and then from putty typed the following code
composer require authorizenet/authorizenet
but still receiving the error message
Your requirements could not be resolved to an installable set of packages.
Problem 1
- goetas/xsd2php 2.1.x-dev requires php >=5.5 -> your PHP version (5.4.45) does not satisfy that requirement.
- goetas/xsd2php 2.1.0 requires php >=5.5 -> your PHP version (5.4.45) does not satisfy that requirement.
- goetas/xsd2php 2.0.0-alpha requires goetas/xsd-reader >=1.0.1,<2.0 -> satisfiable by goetas/xsd-reader[1.0.1] but these conflict with your requirements or minimum-stability.
- goetas/xsd2php 2.0.0 requires php >=5.5 -> your PHP version (5.4.45) does not satisfy that requirement.
- Installation request for goetas/xsd2php 2.*@dev -> satisfiable by goetas/xsd2php[2.0.0, 2.0.0-alpha, 2.1.0, 2.1.x-dev].
Installation failed, reverting ./composer.json to its original content.
What wrong possibly I am doing kindly help...
Thanks in advance.
Both FraudManagement/get-held-transaction-list.php and FraudManagement/approve-or-decline-held-transaction.php call undefined functions. They should be updated to the actual functions defined earlier in their respective files.
I have looked around and tried a few solutions online, but I keep running into method does not exist errors or the data is simply not being saved.
Customer ID:
Name: Markus-Allen Proctor
Company:
Address: 1111 Werkin App St.
City: Baltimore
State/Province: MD
Zip/Postal Code: 20774
Country:
Phone:
Fax:
Email:
The fields I care about never show any information (when logging into auth.net to view subs)
`$paymentSchedule = new AnetAPI\PaymentScheduleType();
$paymentSchedule->setInterval($interval);
$paymentSchedule->setStartDate(new DateTime($date));
$paymentSchedule->setTotalOccurrences(12);
$subscription->setPaymentSchedule($paymentSchedule);
$subscription->setAmount($a);
$subscription->billToAddress = $address;
$subscription->billToCity = $city;
$subscription->billToState = $state;
$subscription->billToZip = $zip;
$subscription->customerEmail = $user->email;
$subscription->customerPhoneNumber = $user->phone;
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber($cardnum);
$creditCard->setExpirationDate("20" . $yy . "-" . $mm);
$creditCard->setCardCode($cvc);
$payment = new AnetAPI\PaymentType();
$payment->setCreditCard($creditCard);
$subscription->setPayment($payment);
$paymentprofile = new AnetAPI\CustomerPaymentProfileType();
$paymentprofile->setCustomerType('individual');
$paymentprofile->setPayment($payment);
$customerprofile = new AnetAPI\CustomerProfileType();
$customerprofile->setEmail($user->email);
$billTo = new AnetAPI\NameAndAddressType();
$billTo->setFirstName($fName);
$billTo->setLastName($lName);
$billTo->setAddress("$address");
$billTo->setCity($city);
$billTo->setState($state);
$billTo->setZip($zip);
$subscription->setBillTo($billTo);
$request = new AnetAPI\ARBCreateSubscriptionRequest();
$request->setmerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);
$request->setSubscription($subscription);
$controller = new AnetController\ARBCreateSubscriptionController($request);`
In short, how do I save the customer's contact info so that it shows up in the authnet console?
Hi
I downloaded the master branch .I tried to create a new profile using CustomerProfiles/create-customer-profile.php . But I get the warning message "failed to open stream: No such file or directory
require(vendor/autoload.php)" .There is no autoload.php or vendor directory .
Any work around?
Fatal error: Using $this when not in object context in %\JMS\Serializer\Serializer.php on line 99
Hello,
Can we fetch the details of individual transactions by submitting the transaction Id from API without using SDK and using simple curl only?
If yes kindly provide an example..
Thanks in advance.
Transaction Failed
Error code : E00124
Error message : The provided access token is invalid
Getting above error message while using method createVisaCheckoutTransaction()
php sample code errors out if no unsettled transactions. if statement prior to foreach should read:
if (($response->getTransactions() != null) && ($response->getMessages()->getResultCode() == "Ok"))
Hey Guys,
We’ve just implemented Authorize.net on our new platform to replace our old one (braintree).
We have done some tests, from the charge credit card example that we adapted to our code.
It worked with Chase and Capital One debits card but didn’t work on any of bank of america debit and credit cards for some mysterious reasons. When looking on my profile I can read "Card declined by issuer”. I called the bank and they said the card wasn’t activated (When you receive a new card you need to activate it first). But all the card we’ve tried have been activated for long and we already processed payments online with (it also work on Braintree).
I went to my merchant service representative but they haven’t been able to help me. Am I doing something wrong? Did you hear about similar issues ? I’m concerned for other banks when turning this thing live.
Here is my piece of code :
`
// Common setup for API credentials
$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName($this->ci->config->item('AUTHNETAPILOGINID'));
$merchantAuthentication->setTransactionKey($this->ci->config->item('AUTHNETKEY'));
$refId = 'ref' . time();
// Remove potential white spaces
$ccn = preg_replace('/\s+/', '', $ccn);
// Create the payment data for a credit card
$creditCard = new AnetAPI\CreditCardType();
$creditCard->setCardNumber( intval( $ccn ) );
$creditCard->setExpirationDate( $exp );
$creditCard->setCardCode( $cvc );
$paymentOne = new AnetAPI\PaymentType();
$paymentOne->setCreditCard($creditCard);
$order = new AnetAPI\OrderType();
$order->setDescription("Ticket");
// Create a transaction
$transactionRequestType = new AnetAPI\TransactionRequestType();
$transactionRequestType->setTransactionType("authCaptureTransaction");
$transactionRequestType->setAmount( $amount );
$transactionRequestType->setOrder( $order );
$transactionRequestType->setPayment($paymentOne);
$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId( $refId );
$request->setTransactionRequest($transactionRequestType);
$controller = new AnetController\CreateTransactionController($request);
$response_api = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);
if ($response_api != null)
{ // more code }`
I was hoping you could help me debut if it’s coming from here. Should I add the postal code or address to make sure it’s not a security issue on their hand ? Where could that come from ? I’m a little lost on this.
Thanks!
there's no sample code for paypal express checkout
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.