We are trying to make multiple payments against an existing order. We have our own digital giftcard system and when the customer wants to pay with the giftcard, we charge the giftcard externally and then simply add that payment using the end point merchants/<merchant id>/orders/<order id>/payments. This properly registers a payment against the order with the appropriate tender. Then we charge the remainder using eCommerce api using a stored credit card. For that we use the pay api /orders/<order id>/pay. In the payload we pass the amount we would like to charge. The problem is that eCommerce api charges the entire amount of the order, ignoring the requested amount. So in the end the order looks like this:
Subtotal : $16.98
Tax : $ 1.40
Total : $18.38
First payment: External Tender - Amount = $10.00 .
Second payment Stored credit card - Charge amount requested $8.38. Actual amount charged $18.38. The total of both payments made becomes $28.38 in this example.
So how can we use the pay api to pay only the remainder of the existing order?
Thanks for your help.