question

coder12 avatar image
coder12 asked taniyuki commented

Payment Not Adding to Order After Calling Update Order Api

Can someone help me with a problem? I am using the javascript clover connector on the cloud solution (Remote Cloud Pay) to connect to the clover device and process payments. For some reason, I cannot update the order to attach payment to it. When I call the update order endpoint, it updates everything but fails to payment to the order. Another strange thing that it does is even though it updates the state of the order to "Closed" or "Locked", the order still shows on the device and web portal as open.


My Updated Order object with the payment attached in is (I removed some stuff for neatness):

{
    "id": "33JQRKKZM7HMY",
    "payments":[{
  "id": "F4K7EREVMVW24",
  "order": {
    "id": "N9MQ83T58CCAG"
  },
  "device": {
    "id": "e5fcd724-99d5-f427-886a-4b604b952684"
  },
  "tender": {
    "href": "https://sandbox.dev.clover.com/v3/merchants/9ZQTAJSQKZ391/tenders/V2WYKSWH4ZZZ4",
    "id": "V2WYKSWH4ZZZ4"
  },
  "amount": 2754,
  "tipAmount": 389,
  "taxAmount": 0,
  "externalPaymentId": "REQV2MX9XSNM7",
  "employee": {
    "id": "VH7JB40JRGCAG"
  },
  "createdTime": 1685861334000,
  "clientCreatedTime": 1685861335000,
  "modifiedTime": 1685861337000,
  "offline": false,
  "result": "SUCCESS"
}]
}


The endpoint URL I am calling is:

https://sandbox.dev.clover.com/v3/merchants/9ZQTAJSQKZ391/orders/33JQRKKZM7HMY


But the response I am getting is:

{
    "href": "https://sandbox.dev.clover.com/v3/merchants/9ZQTAJSQKZ391/orders/33JQRKKZM7HMY",
    "id": "33JQRKKZM7HMY",
    "currency": "USD",
    "employee": {
        "id": "VH7JB40JRGCAG"
    },
    "total": 2755,
    "title": "general@dss.com gwsgew  Paid",
    "orderType": {
        "id": "SS48CC769P32R"
    },
    "taxRemoved": false,
    "isVat": false,
    "state": "Closed",
    "manualTransaction": false,
    "groupLineItems": false,
    "testMode": false,
    "payType": "FULL",
    "createdTime": 1685861320000,
    "clientCreatedTime": 1685861320000,
    "modifiedTime": 1685861343000
}


It seems to totally ignore adding the payment to the order. Am I missing something? Is this a bug?

OrdersPaymentConnectorpaymentstate
10 |2000

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

parquet76 avatar image
parquet76 answered taniyuki commented

Remote Pay Cloud is generally for non Clover point of sales and allows those point of sales to take payment. The assumption is, your point of sale manages its own orders, inventory, etc. and only needs to use Clover to handle the payment. Because all Clover payments require a Clover order Remote Pay Cloud will internally/automatically create a shell order for payment requests initiated by Remote Pay Cloud.

It sounds like you are creating a Clover order and then trying to pay for that Clover order via Remote Pay Cloud. In this case, you will end up with two Clover orders, the Clover order your created via API and the Clover order created by Remote Pay Cloud. Per my knowledge, the only way to "pay" for or "complete" the order you created via API is either via the Clover ecomm (card not present APIs) or via the device itself (have the merchant look the order up and initiate a payment via the Clover device/pos). You cannot update the state or payments on a Clover order directly. That is managed internally by Clover when payment or other actions occur.

If what you desire is to create a Clover order at some point in time and then have the merchant be able to take a card present payment for that order at a later point in time you have two options:

1) Tell the merchant to look-up the order via standard Clover POS functionality (orders app) when the customer shows up, the merchant can then initiate payment.

2) If you want to launch the payment from your web-application then you could still use Remote Pay Cloud (or the REST Pay API - https://docs.clover.com/docs/configuring-a-cloud-connection). You would need an Android App running on the Clover device that would take a Clover order id and launch the order or payment screen. You would then launch your custom app via https://docs.clover.com/docs/using-custom-activities-with-rest-pay-display.

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

coder12 avatar image coder12 commented ·
Thanks for the response, I already have an android application running on the device to communicate with the webapp. How can I trigger display of an atomic order or rest api order through the android app, assuming I have the order Id.
0 Likes 0 ·
parquet76 avatar image parquet76 coder12 commented ·

I am not 100% sure, the intents you can fire are documented here - https://clover.github.io/clover-android-sdk/com/clover/sdk/v1/Intents.html. I would experiment with a few based on how relevant they seem.

0 Likes 0 ·
coder12 avatar image coder12 parquet76 commented ·

Hey, thanks again for the info and prompt response. Upon looking, there doesn't seem to be any Intent to initiate payment for an order. I do see the ACTION_CLOVER_PAY but that opens the payment screen for the order that lets them choose to make a cash or card payment. Is there any possible way to use an intent to show the clover pay display payment screen and lock users from all else?

0 Likes 0 ·
Show more comments
taniyuki avatar image taniyuki commented ·

Oh. It seems to totally ignore adding the payment to the order.

tiny fishing

0 Likes 0 ·
foxclover avatar image
foxclover answered foxclover edited

Hello , I read your question and check your code so what i actually try to say , It appears that you are using the Clover Connector to process payments and update orders. However, the response you received indicates that the payment is not being added to the order successfully. Here are a few things you can check to troubleshoot the issue: Verify payment details: Double-check that the payment details, such as the tender, amount, tipAmount, and taxAmount, are correct and properly formatted. Make sure that the tender ID corresponds to a valid tender in your Clover account. Confirm correct API endpoint: Ensure that you are calling the correct API endpoint for updating orders. The endpoint URL you provided , Official site (https://sandbox.dev.clover.com/v3/merchants/9ZQTAJSQKZ391/orders/33JQRKKZM7HMY) looks correct, but make sure that it is the appropriate endpoint for updating orders. Check API request payload: Review the payload you are sending to the API endpoint. Verify that the payment object is properly nested within the "payments" array and that there are no missing or incorrect fields. The structure you provided in your question seems correct, but check for any discrepancies or missing details. Ensure valid order ID: Confirm that the order ID you are using (33JQRKKZM7HMY) is valid and corresponds to an existing open order in your Clover account. If the order is already closed or locked, it may not be possible to update it with a new payment. Review API documentation: Consult the documentation provided by Clover for the specific API endpoint you are using. Pay close attention to any requirements or restrictions mentioned in the documentation that may affect updating orders with payments. Check for error responses: Look for any error responses or additional information in the API response body or headers. The response you provided does not indicate an error, but there may be additional details that could shed light on the issue. If you have gone through these steps and the issue persists, it would be beneficial to reach out to Clover's support or developer community. They will have more specific knowledge and expertise regarding the Clover Connector and can provide you with further assistance in resolving the problem.

10 |2000

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

mayomayo72218 avatar image
mayomayo72218 answered mayomayo72218 edited

In this case, you will receive two Clover orders, a Clover order created by you through the API, and a Clover order created by Remote Pay Cloud. To my knowledge, the only way to "pay" or "fulfill" an order you've created via the API is through Clover ecomm (card without API) or through the device itself (requires the merchant to view order and initiate payment via the Clover/pos device).

Vampire Survivors

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