When sending a capture transaction for an order that included partial payment via gift card, the capture transaction will attempt to capture the full order amount, without accounting for the fact the the order was already partially paid with a gift card. Is there some way to force the capture transaction to only capture the unpaid balance?
For example, an order is place where the order total (merchandise, tax, and freight) is $76.48. A $10 gift card is applied during checkout, leaving an unpaid balance of $66.48. The shop is setup to only authorize payments at checkout, and the credit card on the order is authorized for the unpaid balance of $66.48.
Later, when sending a simple capture request ({"transaction":{"kind":"capture"}}), I would expect this to only attempt to capture the unpaid balance since I am not specifying an amount in the API request. But instead, Shopify will attempt to capture the entire order amount of $76.48 (ignoring the $10 paid by gift card). This capture transaction will fail since the authorization is only for $66.48, and Shopify will return an error result ({"errors":{"base":["Cannot capture more than the authorized 66.48 for this payment."]}})
Any suggestions on how to force the capture to only capture the unpaid balance are appreciated!
No, I haven't found a solution to this problem. Technically, I suppose I could read through all of the transactions to try to add up what amount is still owed, but that isn't a good long-term solution since Shopify may add or change the payment transactions and cause the logic to fail. Since the 'authorize' transaction already accomodated the gift card amounts, it seems that the 'capture' transacation should as well. The fact that it doesn't seems like a bug to me.
Can anyone from Shopify confirm the definitive logic app developers must use to capture a full payment amount on an order without causing an error?
The documentation on https://shopify.dev/docs/admin-api/rest/reference/orders/transaction#create-2020-10 states:
Capture the full amount for an authorized order, and associate the capture with an authorization by including its authorization code
However, it seems that when a Gift Card is used we need to do an additional calculation to ensure we don't over-charge the authorized card. In addition to using Gift Cards, are there other considerations we must take into account when trying to capture remaining payment on an order? Is there general documentation on how we must manually perform this calculation given all possible use-cases?
Sorry if I am missing something obvious but I was unable to find clear documentation that states exactly how to determine what the remaining balance on an order is.
Would very much appreciate an answer from one of the Shopify staff how capture should be handled through API. We've noticed the same happening also when you remove an item in the order and replace it (for instance a change of color). The capture API will attempt to capture the amount for both items even if one was removed.
You can also see when you check the response for the order in question (through API) that both line items still exist, the total_price field has a sum for BOTH items, it's just that the removed item appears in refund_items array as well....very confusing and poorly done.
So, like I said, I'd appreciate an answer.
User | Count |
---|---|
25 | |
8 | |
7 | |
5 | |
4 |