question

Ghalib Soomro avatar image
Ghalib Soomro asked zgreathouse Deactivated answered

How to get discounts on each payment object via the REST API

'https://www.clover.com/v3/merchants/' . $merchnat_id . '/payments?expand=order.refunds'

I want the discount object inside each payment object as well.
REST APIPaymentsDiscounts
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

zgreathouse avatar image
zgreathouse Deactivated answered
Payments and Discounts are not directly related. Rather, payments and discounts are related through an Order.

There are two types of discounts:
- Order Level Discounts
- Line Item Discounts

We have this structure, as the payment is not what is being discounted. It is the whole order or a specific line item which a discount is applied to.

Here is an endpoint which would allow you to get both the payment object and the order level discounts object:
GET /v3/merchants/{mId}/orders/{orderId}?expand=payments,discounts

The above endpoint however does not include lineItem discounts. To get discounts of all types, use the following endpoint:
GET /v3/merchants/{mId}/orders/{orderId}/discounts

See our API reference docs here:
https://docs.clover.com/clover-platform/reference#getorder-1
10 |2000

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