Reply
Highlighted
Member
Posts: 4
Registered: ‎11-12-2018

custom fields in the embedded hosted form

sim.php was elegant... I can not for the life of me figure out the 

  • Option 2:Embed our hosted, mobile-optimized payment information form in your page to collect the card information in a PCI-DSS SAQ A compliant way.

on https://developer.authorize.net/api/reference/features/acceptjs.html to do any of this! 

 

I just want to be able to do this dynamically in a php file, 

$x_Description = $_REQUEST['x_Description'];
$x_Amount = $_REQUEST['x_Amount'];
$x_cust_id = $_REQUEST['x_cust_id'];
$x_company = $_REQUEST['x_company'];
$x_po_num = $_REQUEST['x_po_num'];
$x_event = $_REQUEST['x_event'];

 

and then send it off the Authorize.net..... Admins here tell everyone it is possible and they send them to links in the API documentation, but THERE REALLY IS SOMETHING MISSING there... there are some missing step.... I don't know what those dots are in front of the field, I don't know where they fit in context.... help, please.... this is all very confusing and I'm not  stupid person... but 10 hours later and I can;t figure any of this out, even though sim.php works, I made that work...but this new stuff?? I'm completely lost... I can't be alone... 

 

My needs are exceedingly simple... I just need to pass a customer id and price... how does the form pick up the price? I don't know...I can't see it being done anywhere.... 

 

Thank you.... I dont need a link to an API doc...I keep clicking on them, hoping I just missed something basic.... I need a sample of a sim.php integration --> embedded hosted form....

Highlighted
All Star
Posts: 727
Registered: ‎11-05-2018

Re: custom fields in the embedded hosted form

Few thoughts for you. When you say “those dots in front of the field”? What are you looking at? Are you looking at the json respone on the website? Or are you looking at the sample code on GitHub? I would use the redirect method rather than the embedded method if you’re trying to be simple as well. As for how does the form get the price, you pass that value in your php script when you do the API call.

The sample code on the API documentation page will get you 90% of the way there. Do you have the php sdk composer package? That’s what you need to make API calls with php.
Highlighted
Member
Posts: 4
Registered: ‎11-12-2018

Re: custom fields in the embedded hosted form

Flinging questions at me like this does not help, but thank you for your efforts. I understand why you asked them; I understand you are seeking clarity.... so am I.

 

The dots in front of the fields on this: https://developer.authorize.net/api/reference/#accept-suite-get-an-accept-payment-page  I do not understand the nomenclature and it is not explained, yet when someone took the time to put dots there, they probably mean something.... I have no idea what they mean.

 

When Google Maps migrated to their v3 API, they had a complete step-by-step for those using their 1.0, 2.0 API... it works flawlessly... that is what I am looking for.

 

If you are using the SIM solution, here is how these field map to the new API, where is how you install accept.js, etc. The code samples are woefully incomplete, written by someone who does not understand that there are intermediate users who don't live their lives in code. We just want the payment stuff to work like it works already in SIM. This is not a hard concept.

 

I get I need to create a token, like SIM creates a hash, that contains the amount and timecode and all that stuff... yet this step is not anywhere in the documentation... I've spent HOURS looking for it and do not see it in any of the sample code... this seems like it should be a basic...

 

90% is the problem... if I can't complete the 10% that is missing, I am at 0% implementation. 

 

That is my frustration. I write user manuals and instructional material for a living. I am well-trained in that skill. This is perhaps why their API is incomprehensible... it was written at a high-level, skipping critical steps, assuming everyone knows what they are. We don't.

 

I'll eventually get this working, but not at the expense of the stuff that brings in revenue. We're just going to tell our clients that we don't work with Authorize.net unless the SIM works... we're directing them to other payments providers and the only ones that lose out is Authorize.net.... who doesn't seem to really care if we're here or not. 

 

Thank you for the time you took to help with my original question and reading this more detailed frustrration.

 

G.

 

Highlighted
All Star
Posts: 727
Registered: ‎11-05-2018

Re: custom fields in the embedded hosted form

I’m flinging questions at you so that I can help you my friend.I can get you right there. It will take a few days. I’m not the best programmer in the world either, by the way, and I promise you I’ve paid my dues learning this. I know how it feels to be stuck and ready to pull your hair out. I can’t wait for it to happen again tomorrow.......

I think you are referring to this.

$setting2 = new AnetAPI\SettingType();
$setting2->setSettingName("hostedPaymentOrderOptions");
$setting2->setSettingValue("{\"show\": false}");

The : between show and false are part of a syntax just like any language. It is how to communicate with the API.

The api interprets the above as “don’t show the hosted payment order options”. If you changed the false to true, it would interpret it as “show the hosted payment order options”.

The difference that makes on the form is that when it is set to false, the PO number, description, amount, etc. do not show on the first page of the order.

If you leave out the : the API is confused and doesn’t know what you’re telling it to do.

I gather from your php script that you need to pass an order description, purchase order number, order amount, customer id, company, and event. You need these details to be part of the transaction. Most of those I could tell you how to do right now. There are some prelim steps though.

Here’s how to get a token. You need an application called composer. Download it. It is free. Install it. Then get the authorize.net php composer package from GitHub. Just get a zip file of the whole thing. Unzip that file into your websites folder on your computer. The folder that results will be called something like sdk-php-master. Shift + right click on that folder to pull up a command prompt or powershell window.

Type this in your command prompt or powershell window:

composer update

If composer doesn’t give you any errors then you’ve got what you need.

Then copy and paste that sample code from the link you gave me. The sample php code. Paste it on your own php file. You will want to put your credentials on the samplecodeconstants file that is in the sdk-php-master folder.

Then you just run that php script and it should respond with a token. The token will be in your browser window.

This might require some extra debugging, but not much. Any errors your get will most likely be due to the folder structure in your website. So just change the require and/or include paths that are in that sample code.

Once you’ve got a token it is child’s play to pass it to generate a form.

I understand your need for a roadmap and I am willing to help you. There is a lot to learn here and a full roadmap from that php script you wrote to this might require a book on object oriented programming, and maybe some other things as well. But the nice thing about it is you don’t have to understand it 100% as long as it works. If you want to keep at it let me know. Try what I put above. It will work. And once it works, you will know that you have the API files configured correctly on your website.






Highlighted
Contributor
Posts: 51
Registered: ‎10-28-2015

Re: custom fields in the embedded hosted form

I learned the hard way that custom (merchant defined) fields are no longer functional in the Accept Hosted API.

 

See this thread: https://community.developer.authorize.net/t5/Integration-and-Testing/Accept-Hosted-in-iFrame-ANY-way...

 

We had to change our entire way of handling pass-through data.

 

Good luck, Fritz

Highlighted
Administrator
Posts: 145
Registered: ‎11-29-2017

Re: custom fields in the embedded hosted form

Re: Dots in api reference guide.

The dots reference the nesting of the XML nodes. It may make more sense to look at the API Live console formatting as a guide.

 

Example:

* payment

** creditCard (nested inside the payment node)

***cardNumber (nested inside the creditCard node)

***expirationDate

***cardCode

 

    <payment>
      <creditCard>
        <cardNumber>5424000000000015</cardNumber>
        <expirationDate>2020-12</expirationDate>
        <cardCode>999</cardCode>
      </creditCard>
    </payment>

 

Here is the complete XSD reference-

https://apitest.authorize.net/xml/v1/schema/AnetApiSchema.xsd

 

I hope this helps!