question

01928-7325x2 avatar image
01928-7325x2 asked bryanvargas commented

Create charge endpoint calculation

I'm using create charge endpoint(https://scl-sandbox.dev.clover.com/v1/charges).
However the payment receipt is showing different amount than the total amount I sent.

Sample payload

{
  amount: 4400,
  tipAmount: 660,
  taxAmount: 440,
  source: 'clv_XXSTS1LXnXevtX44n9dmXXXX',
  currency: 'usd',
  receiptEmail: 'user@email.com'
}


Receipt
screenshot-2023-04-14-at-111314-pm.png


Payment data displayed in the Clover order page
screenshot-2023-04-14-at-111404-pm.png

What could be the problem?
Here is the payment receipt link: https://sandbox.dev.clover.com/p/ZFK003SWYEM34


Paymentsecommerce
10 |2000

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

bryanvargas avatar image
bryanvargas answered 01928-7325x2 commented

If the charge request includes tax (tax_rate_uuid or tax_amount), this value must be the sum of all item prices and any tax or tip. Example: If the item costs $10 and the tax is $1, the amount is 1100 ($11).
Here is my example:


{  
"amount": 2000,
 "tip_amount": 350,
    "tax_amount": 200
     "capture": true,
     "currency": "USD",
     "description": "test",
     "ecomind": "ecom",
     "receipt_email": "{email}",
     "source": "cToken"
}

screenshot-2023-04-14-at-122042-pm.png


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

01928-7325x2 avatar image 01928-7325x2 commented ·

In your example receipt
subtotal 1800
tax 200
tip 350

But in your payload the amount is 2000 which missing the tip amount. I thought the amount should includes everything?
How could your payload displayed correctly in the payment receipt?


0 Likes 0 ·
01928-7325x2 avatar image 01928-7325x2 01928-7325x2 commented ·
@bryan.vargas I'm not sure how this marked as accepted answer. There is still unanswered question here.

Thanks!

0 Likes 0 ·
01928-7325x2 avatar image
01928-7325x2 answered 01928-7325x2 edited


Sorry, I still don't understand from the last reply.
Maybe the example below is better
In the payment detail it shows the correct payment amount and tip amount.
My payload has tax_amount, so the total payment amount is subtotal + tip amount which is correct $32.40.

screenshot-2023-04-14-at-113431-pm.png


Payment receipt showing subtotal + tip


screenshot-2023-04-14-at-113439-pm.png


10 |2000

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

01928-7325x2 avatar image
01928-7325x2 answered bryanvargas commented

Here is the same order but the 'tip_amount' is not included in the 'amount'

screenshot-2023-04-15-at-10237-am.png


The payment receipt is correct.
screenshot-2023-04-15-at-10325-am.png


Maybe I misunderstood what "Payment amount" means in the order page? But per documentation, the tip must be included in the payload's "amount" prop.


1 comment
10 |2000

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

bryanvargas avatar image bryanvargas ♦♦ commented ·

The answer I provided is still valid. Your other examples did not include the taxes so the subtotal will the total you presented and the total will be the included tips. , please review : https://docs.clover.com/docs/calculating-order-totals


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