question

Sergey avatar image
Sergey asked ·

"Token is invalid" error

Hello, Im using e-commerce api with iframe tokenization to save credit card on customer file :

https://scl-sandbox.dev.clover.com/v1/customers endpoint with email, name, and token received from the iframe as source. The source is saved as expected on customer record :

"cards": {

"elements": [

{

"id": "XYZ",

"first6": "601136",

"last4": "6668",

"cardType": "DISCOVER",

"token": "clv_XXX",

"tokenType": "CTOKEN",

"modifiedTime": 1590606477000,

"customer": {

"id": "ZYX"

}

}

]

},

When I try to pay for order that I created previously by calling https://apisandbox.dev.clover.com/v2/merchant/{MERCHANTID}/pay endpoint sending

{

"orderId": "XYZ",

"currency": "USD",

"amount": 890,

"tipAmount": 116,

"taxAmount": 70,

"last4": "6668",

"first6": "601136",

"zip": null,

"expMonth": 0,

"expYear": 0,

"cvv": null,

"cardEncrypted": null,

"vaultedCard": {

"token": "clv_XXX",

"first6": "545454",

"last4": "5454",

"expirationDate": null

}

}

I get "Token is invalid" error.

The same call for paying order will work if the card is added on POS device or if the token created by DevPay endpoint

Can token saved by e-commerce api be used by orders api ? (i can not use e-commerce api for payment for the order because currently it doesnt support passing tip amount for the charge)

Thanks

Orderse-commerce api
10 |2000 characters needed characters left characters exceeded

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

1 Answer

· Write an Answer
David Marginian avatar image
David Marginian answered ·

Our docs are out of date. Tipping is supported. Please set tip_amount on CreateChargeRequest.

8 comments Share
10 |2000 characters needed characters left characters exceeded

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

Thank you. Can I also set tax_amount?

0 Likes 0 · ·

Yes, I believe so.

0 Likes 0 · ·

Thank you for your response. Unfortunately e-commerce pay for order api ignores the payment amount and charge the source for full order amount ( in my case the order should be paid partially with credit card and partially with gift card):

Is it wrong to submit payment with vaulted card for order when the vaulted card token created from e-commerce api ?


0 Likes 0 · ·
1590613152783.png (49.7 KiB)

Are you trying to pay for only certain line items, or is it an arbitrary amount?

0 Likes 0 · ·
Sergey avatar image Sergey David Marginian ♦♦ ·

An arbitrary amount. Customer have digital wallet with loyalty money and I want to split the payment - use the digital wallet money and the rest to pay with credit card

0 Likes 0 · ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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

Welcome to the
Clover Developer Community