question

sebaxtz avatar image
sebaxtz asked sebaxtz published

http 500 in create customer API

hi, trying to create a customer and card using the token response from the hosted iframe, and I'm getting http500.. am I missing something ?


{

"message": "500 Internal Server Error"

}




curl --request POST \
3 --header 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxx' \
4 --header 'Content-Type: application/json' \
5 --data '
6 {
7 "cards": [
8 {
9 "additionalInfo": {},
10 "customer": {},
11 "first6": "601136",
12 "last4": "6668",
13 "cardType": "DISCOVER",
14 "token": "clv_xxxxxxxxxxxxxxxxxxxxx",
15 "tokenType": "CTOKEN"
16 }
17 ],
18 "firstName": "aaaaaaaa",
19 "lastName": "bbbbbbbbb"
20 }
21 '


I kwon I can use v1/customers, however I prefer using v3 one because there is a lot more fields to store there.


thank you so much


Customers
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

David Marginian avatar image
David Marginian Deactivated answered sebaxtz commented

Please don't include tokens in public posts (even if it is just sandbox). Despite what our docs say you can't create a customer and pass in "cards". If you want to save a card on file you must follow the instuctions here - https://docs.clover.com/docs/ecommerce-saving-card.. See this section if the customer already exists https://docs.clover.com/docs/ecommerce-saving-card#saving-a-card-for-an-existing-customer.

4 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sebaxtz avatar image sebaxtz commented ·

I know that I cant pass in cards, I wanted to pass the token Ive got from a hosted iframe. By using that method would save me another api call to update other fields like addresses, phone numbers array, and some metadata.


no way I Can use v3/nnnnnn/customers ?


thank you

0 Likes 0 ·
sebaxtz avatar image sebaxtz sebaxtz commented ·

I just realized that I get 500 when I send the "CTOKEN" param, without it the customers is created, but cant be charged

clover:https://sandbox.dev.clover.com/v3/merchants/nnnnnnnnnnnn/customers

content:{"firstName":"TOROBER OPER","lastName":"TOROBER OPER","cards":[{"exp_month":"1","exp_year":"2023","first6":"601136","last4":"6668","brand":"DISCOVER","address_zip":"11111","token":"clv_nnnnnnnnnnn"}]}

http:200

{href=https://sandbox.dev.clover.com/v3/merchants/KQCAHD6EZB5N1/customers/D521HTVFDJZFP, id=D521HTVFDJZFP, firstName=TOROBER OPER, lastName=TOROBER OPER, marketingAllowed=false, customerSince=1.64217351E12}



thank you so much for your help!


0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ sebaxtz commented ·

The API is not designed to be used the way you are trying to use it. I understand you would like to do things your way, but that isn't how things work. You need to follow the steps provided here https://docs.clover.com/docs/ecommerce-saving-card..

0 Likes 0 ·
Show more comments

Welcome to the
Clover Developer Community