I'm trying to run the sample code for Charge A Card from the API Reference but am getting an Uncaught Exception error for JMS\Serializer\Exception\RuntimeException. The long error message ends with "YamlDriver.php on line 38".
I've played around with it and have found that it's the CustomerDataType that is causing the problem. If I remove the lines of code for setId and setEmail then it works fine.
Has anyone else seen this?
12-09-2015 12:05 AM
Hello @awtech,
Can you please provide the full error message? It will be really helpful in rectifying the issue.
Also, from the error I am guessing that your development environment is not setup completely. There are some dependencies that need to be installed locally before using sample codes. Look into https://github.com/AuthorizeNet/sdk-php/blob/master/README.md with installation instructions. You will need composer for installation of all dependencies.
Hope it helps.
12-17-2015 03:14 AM
Thanks for the reply. Yes, I did run the composer.json file in order to pull in the over 2,000 dependency files - otherwise none of the example code would run. I have to say that I'm surprised that Authorize.net requires all this 3rd party cody for something a security related as processing credit cards. Seems a big risk to be pulling in that many 3rd party files that they have no control over... and is all that really necessary to just process some credit cards? Seems like a bunch of overkill to me and it's been a really frustrating process trying to work with this API.
In any case, the problem is when I run the sample code I have to comment out 3 lines of code for setting the customerID. It runs fine with these 3 lines commented out, but if they're left in, it throws the error below.
$customer = new AnetAPI\CustomerDataType();
$customer->setId("101");
$transactionRequestType->setCustomer($customer);
Error displayed:
Fatal error: Uncaught exception 'JMS\Serializer\Exception\RuntimeException' with message 'Expected metadata for class net\authorize\api\contract\v1\CustomerDataType to be defined in /home/awtechho/public_html/helios/chase/lib/net/authorize/api/controller/base/../../yml/v1/CustomerDataType.yml.' in /home/awtechho/public_html/helios/chase/vendor/jms/serializer/src/JMS/Serializer/Metadata/Driver/YamlDriver.php:38 Stack trace: #0 /home/awtechho/public_html/helios/chase/vendor/jms/metadata/src/Metadata/Driver/AbstractFileDriver.php(28): JMS\Serializer\Metadata\Driver\YamlDriver->loadMetadataFromFile(Object(ReflectionClass), '/home/awtechho/...') #1 /home/awtechho/public_html/helios/chase/vendor/jms/metadata/src/Metadata/Driver/DriverChain.php(38): Metadata\Driver\AbstractFileDriver->loadMetadataForClass(Object(ReflectionClass)) #2 /home/awtechho/public_html/helios/chase/vendor/jms/metadata/src/Metadata/MetadataFactory.php(103): Metadata\Driver\DriverChain->loadMetadataForClass(Object(ReflectionClass)) #3 /home/awtechho/public_ in /home/awtechho/public_html/helios/chase/vendor/jms/serializer/src/JMS/Serializer/Metadata/Driver/YamlDriver.php on line 38
12-17-2015 09:59 PM