question

kengr avatar image
kengr asked David Marginian Deactivated answered

Pay For Order Error: Either payment instrument or customer has to be present

I create a customer, get a token for a test card the one that is 4242, create an order then I try to user the "Pay for an order" call. I get this error:
Here is essentially my request:


curl --request POST \
     --url https://scl-sandbox.dev.clover.com/v1/orders/<ORDER_ID>/pay \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Content-Type: application/json' \
     --data '
{
     "ecomind": "ecom",
     "level2": {
          "tax_indicator": 0
     },
     "customer": "<CUSTOMER_ID>",
     "email": "customer@gmail.com",
     "source": " <CARD_TOKEN>"
}
'
Here is the error:
{
  "message": "400 Bad Request",
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_request",
    "message": "Either payment instrument or customer has to be present"
  }
}

I was able to use the token to do a charge but it seems like if my intention is to pay for orders then this call is the right one. Any guidance would be greatly appreciated.

API Tokenecommerce
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

You can only pass a "source" or a "customer", not both. When you pass both there is a conflict, we don't know whether to use the "source" or the "customer" (e.g. card on file).

10 |2000

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

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