cancel
Showing results for 
Search instead for 
Did you mean: 

accept.js - purpose

So I thought accept.js was the answer to my integration. Post credit card details directly from the client browser to auth.net and it never even hits my servers. Just save the token (or nonce).  But I'm finding it only works once?!  If i enter a new card and save it, then post a transaction, it works, but only the first time.

 

Did I misunderstand the purpose of accept.js?  Is it supposed to only work once?

rickstout
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hello @rickstout

 

You are currect that in it's current form you can only use it for new transactions.  An update coming very soon will will expand support for using Accept.js for creating customer profiles and for creating subscriptions, making it usable for all transactions.

 

I would suggest watching our blog, or even subscribing so you'll be the first to know.

 

Richard

View solution in original post

RichardH
Administrator Administrator
Administrator
20 REPLIES 20

Hello @rickstout

 

You are currect that in it's current form you can only use it for new transactions.  An update coming very soon will will expand support for using Accept.js for creating customer profiles and for creating subscriptions, making it usable for all transactions.

 

I would suggest watching our blog, or even subscribing so you'll be the first to know.

 

Richard

RichardH
Administrator Administrator
Administrator

Thanks.  Wish the docs would have been clear about that.

Hi,

What does the JSON cardData payload look like for including the CVV security code?

  

For example in step #3 here only has the PAN and expiration date mentioned,

 

http://developer.authorize.net/api/reference/features/acceptjs.html

 

cardData.cardNumber = document.getElementById('CARDNUMBER_ID').value;
cardData.month = document.getElementById('EXPIRY_MONTH_ID').value;
cardData.year = document.getElementById('EXPIRY_YEAR_ID').value;

 

I couldn't find any documentation about the Accept functions and data structures, i.e.

Accept.dispatchData(secureData, 'responseHandler'). Does such documentation exist?

 

Also IMO it would be better if the Accept.dispatchData() supported a non-global functions for the 'responseHandler' callback. Is that a technical limitation why it takes a string value?

 

Thanks

Hello @blackbeltdev

 

Accept.js documentation is scheduled for an update week, but here are some items that should help.

 

Methods, Objects, and Events

DISPATCHDATA

This method sends the secure data to Authorize.Net and provides the response handler which will receive the payment nonce.

Parameter Type Description
data SecureData This object contains the payment data to be sent to Authorize.Net.
callback String This function handles the response from Authorize.Net.

SECUREDATA

This object contains the merchant identifier and payment data.

Property Type Description
secureData SecureData Object This object is the payment data to be sent to Authorize.Net.
authData AuthData Object This object contains the data used by Authorize.Net to identify the merchant who will eventually use the card data.

CARDDATA

This object contains the payment data which is dispatched to Authorize.Net.

Property Type Description
cardNumber String Must be a valid 13-16 digit card number. Required.
month String 2-digit month. Required
year String 2-digit year. Required
cardCode String 3 or 4-digit card validation value (CVV). Optional
zip String 20-character alphanumeric representing postal code. Optional
fullName String 64-character alphanumeric cardholder name. Optional

AUTHDATA

This object contains the data used by Authorize.Net to identify the merchant who will eventually use the card data.

Property Type Description
apiLoginID String API Login ID of the merchant. It can be found in the Authorize.Net merchant interface at Account > Settings > Security Settings > General Security Settings > API Credentials and Keys. Required.
clientKey String Public key for the merchant. It can be generated in the Authorize.Net Merchant interface at Account > Settings > Security Settings > General Security Settings > Manage Public Client Key. Required.

@rickstout You can now create a customer payment profile with the Accept payment nonce, so that you can charge the card on a recurring/future/ad-hoc basis.

 

So instead of/as well as doing a CReateTransaction you can do 

 

<createCustomerPaymentProfileRequest>
<merchantAuthentication>
</merchantAuthentication>
<customerProfileId>10000</customerProfileId>
<paymentProfile>
<payment>
<opaqueData>
<dataDescriptor>COMMON.ACCEPT.INAPP.PAYMENT</dataDescriptor>
<dataValue>nonce_here</dataValue >
</opaqueData>
</payment>
</paymentProfile>
<validationMode>testMode</validationMode>
</createCustomerPaymentProfileRequest>

@blackbeltdev  You are absolutely right and we should support a function as well as a function name for the responseHandler.  No technical limitations, hands up, it was a miss on our side.  It will be fixed in the next release.

 

Brian

Perfect this is exactly what I was looking for! The only other question I had is if the dispatch method could be updated in a future release to support taking a function for the 'callback' argument in addtion to a string, i.e. function | string

 

For instance let's say I wanted to create an Angular service that was self-contained to manage the response handler. I believe the current API requires me to install a global function to work which IMO violates separation of concerns. If this is a technical limitation I can live with that but to make the API cleaner it should accept a function if possible.

 

Thanks

You beat me to the punch! Thanks!

Any idea if the non-global function feature has been added yet? Where can I see a changelog for the new API or accept.js specifically? @brianmc @RichardH any info ? thx in advance