I'm trying to edit/add credit cards using Commerce...
# suitecommerce
v
I'm trying to edit/add credit cards using Commerce API (addCreditCard(), updateCreditCard()), but am getting an error "Unexpected failure". Has anyone faced this issue? How can I troubleshoot the error?
m
Share your sample code and logs so we can further look and tell.
v
Copy code
ModelsInit.customer.addCreditCard({
					ccnumber: data.cardNumber,
					ccname: data.cardName,
					paymentmethod: data.paymentMethod,
					expmonth: data.expiryMonth,
					expyear: data.expiryYear,
					ccdefault: data.isDefault
				});
this is how i'm calling the method
This is the error log i get when the above line is executed: Unexpected failure
no other info
This is what was inside the "data" obj:
Copy code
{
  "cardNumber": "4111111111111111",
  "cardName": "Test",
  "paymentMethod": "5",
  "expiryMonth": "02",
  "expiryYear": "2022",
  "isDefault": false
}
I also tried setting ccdefault to "T"/"F"
m
What version of SCS or SCA you using?
v
SCS 2020.1.8.1
m
Have you tried doing the same with SuiteScript?
v
No, not yet.
m
Try with that as all the ModelInit objects are wrapper objects.
v
Okay, will try that.
👍 1
Thanks!
SuiteScript worked for me. I'm still able to get the cards via Commerce API though, I'm doing the write operations via SuiteScript now.
👍 1
m
Great!