cancel
Showing results for 
Search instead for 
Did you mean: 

Error while adding new paymentProfile - {\"code\":\"E00114\",\"text\":\"Invalid OTS Token.\"}

Hi, we're trying to add a new customerPaymentProfile for an existing customerProfile. we're patterning our code on the github example you provided
https://github.com/AuthorizeNet/sample-code-node/blob/master/CustomerProfiles/create-customer-paymen...

the only difference is that, we don't pass CC details to our servers. instead, we pass opaqueData. on Initial customerProfile creation(with a single payment profile) it works w/c is good. but if we try to add a new paymentProfile(using a new opaqueData) we get the error mentioned on the subject. Can you please help us regarding this?

theorb
Member
1 ACCEPTED SOLUTION

Accepted Solutions

We were doing something wrong, by doing trial and error(via API) to determine if a customer exists or not.

So we tried to create a customerProfile, w/ customerPaymentProfile & this will throw error if customerProfile already exist(if its a duplicate email). Whats good here, is that customerProfileId will be returned w/ the error payload.

 

Now we though of using customerProfileId from error payload, to create a new payment profile for the customer, giving us some edge by reducing one DB call on our system.

 

The issue with our strategy, is that apparently, opaqueData will expire, when we use it to create customerProfile(w/ payment profile) even though the request failed(duplicate user error).

 

So resolution is to save customer info in our system, and check if it's a returning customer or not. If it is, then get customerProfileId from db, and create new customerPaymentProfile on authorize.net

 

One could also create customerProfile first, w/o the customerPaymentProfile. if this transaction fails, then at least you haven't used the opaqueData yet and you get the customerProfileId w/o doing any query on your db. So when you try to create a new customerPaymentProfile, you won't get error code E00114 since opaqueData isn't used yet.

 

lessons learned the hard way for us, but hopefully it helps someone.

View solution in original post

theorb
Member
2 REPLIES 2

Hi @RichardH can you help us about this one please?

theorb
Member

We were doing something wrong, by doing trial and error(via API) to determine if a customer exists or not.

So we tried to create a customerProfile, w/ customerPaymentProfile & this will throw error if customerProfile already exist(if its a duplicate email). Whats good here, is that customerProfileId will be returned w/ the error payload.

 

Now we though of using customerProfileId from error payload, to create a new payment profile for the customer, giving us some edge by reducing one DB call on our system.

 

The issue with our strategy, is that apparently, opaqueData will expire, when we use it to create customerProfile(w/ payment profile) even though the request failed(duplicate user error).

 

So resolution is to save customer info in our system, and check if it's a returning customer or not. If it is, then get customerProfileId from db, and create new customerPaymentProfile on authorize.net

 

One could also create customerProfile first, w/o the customerPaymentProfile. if this transaction fails, then at least you haven't used the opaqueData yet and you get the customerProfileId w/o doing any query on your db. So when you try to create a new customerPaymentProfile, you won't get error code E00114 since opaqueData isn't used yet.

 

lessons learned the hard way for us, but hopefully it helps someone.

theorb
Member