Showing results for 
Search instead for 
Did you mean: 

Require fields on accept.js hosted form?

My integration with accept.js hosted form is working, but I'm unsure how to set which fields are required in the modal popup.


For example, how to I require First/Last Name and Card Code?


The only solution I've found is to go into your Payment Form - Fields settings and require the relevant fields. 


This will not enforce a required field on the UI form, however. It will just fail transactions that do not have the required values. Far from perfect -- let me know if there's a better solution.


I just glanced at the reference and it looks like the way to enforce the zip code is to pass it in the API call. So what I would do is build a payment form that is hosted on your server to collect the billing address. Then post the billing info to auth.nets form and let authnet collect the cardholder data. It is a little clunky to have a 2 step billing process like that, but might be the best you can do.
Hello again, @Renaissance thanks for commenting.

Agreed. Seems silly though. I'll have to add zip code to my form, then the user will get presented with another zip code field in the hosted modal. I don't see a way to default any values on the modal, do you?
@george on my PHP based form it passes onto the form prefilled. You can leave the form field out too I think, in this case, and it will still validate.
Per API reference

Optionally, you can pass the nonce along with the customer's billing address in your createTransactionRequest API call, in which case the postal code included in the API call will be used in AVS checks instead. For AVS checks, the postal code used with createTransactionRequest takes precedence over the value in the nonce.

So I say have them only filled out billing info once.