question

flevour avatar image
flevour asked David Marginian Deactivated edited

API failing response but actually going through

At Fri May 14 2021 18:30:46 GMT+0000 we've sent a request for a refund

REQUEST
POST https://scl-sandbox.dev.clover.com/v1/refunds
{"charge":"5AD6B3P2XPPJC","reason":"requested_by_customer"}

RESPONSE
{"message":"503 Service Unavailable","error":{"code":"processing_error","message":"Sorry, but we are having a brief maintenance.  Check back in a few minutes."}}


Upon further inspection the order 7YS2WZP8G7ZQT appears as refunded in Clover.

This is one instance of an issue we've also seen with the order charge API where the API would reply with a failure code, but attempting the charge again would result in a "order already paid error".

REST APIRefund
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 David Marginian Deactivated edited

Update:

It looks like idempotency keys are not supported by the refund/return endpoints. I pinged EComm about this and it looks like the gateway emulator was slow to get us a response and the request timed out.

Original:

Have you looked into using idempotency keys - https://docs.clover.com/docs/ecommerce-accepting-payments#using-idempotency-keys?

5 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.

wsadiq avatar image wsadiq commented ·

Do they also work with pay api or just charges?

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

Yes, they work with the v1/pay endpoint.

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

Great. Did not know that. Thanks.

0 Likes 0 ·
flevour avatar image flevour commented ·

Could you please help better understand how would this solve the issue? Clover API returns an error when it actually has executed the side-effect that it was supposed to achieve. Are supposed to keep trying with the same idempotency key until it succeeds? Is there anything you can do to fix this on your side?

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

I have pinged the EComm team about this, and will update you when I hear back. Generally, for an error response you will want to retry your request, and if you use an idempotency key in the original request, and the same key for the retry you SHOULD get back the actual response (200) on the retry.

0 Likes 0 ·

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