Use this endpoint to refund payments Truemed has already processed on your behalf. Partial refunds are supported.
Request Notes
The amount requested must be less than or equal to the total amount that the
payment was originally created with.
Itemizing a refund
amount is what Truemed refunds. item_details tells Truemed how to attribute that amount across
the order’s lines.
- Set each
item_details[].total to the amount you are refunding for that line. It cannot exceed
that item’s total_refundable from
Get Payment Status.
- Across all lines, the totals must not sum above
amount.
- The totals may sum below
amount. Truemed applies the remainder across the session’s captures.
Order-level charges and discounts
create_payment_session accepts an amount_details object at the order level, carrying charges and
discounts that belong to the order rather than to any single line. Shipping and tax behave the same
way.
Because Truemed tracks total_refundable per item, an order-level amount appears in no item’s
total_refundable. For a full refund, set amount to the full captured amount and each
item_details[].total to that item’s total_refundable. The item totals then sum below amount by
the order-level amount, and Truemed applies that remainder across the session’s captures.
On a partial refund, amount sets how much of an order-level charge returns. To return none of it,
set amount equal to the sum of your item totals.
How much returns to the HSA/FSA card
Truemed derives the HSA/FSA share of a refund from the lines you itemize:
- When every itemized line is HSA/FSA-eligible, the whole
amount returns to the HSA/FSA card.
- Otherwise Truemed pro-rates
amount by the eligible ratio of the itemized lines.
- Truemed caps the result at what the order captured to the HSA/FSA card, minus what earlier refunds
already returned there. A refund never sends more to the HSA/FSA card than the order put there.
A refund sent without item_details returns to the HSA/FSA card first, up to the remaining eligible
amount. The same amount on the same order therefore splits differently depending on whether you
send item_details. Send item_details when you want the split to follow specific lines.
A refund with no itemizable line behind it, such as returning shipping on its own, carries no
item_details and so takes the HSA/FSA-first path.
Response Notes
Bad Request
HTTP Status: 400
If a field is missing or the request is otherwise can’t be processed, we’ll return a 400
with the following fields:
error - can be one of:
MissingField: one of the required fields is not present in the request
AmountInvalid: the amount field is negative, 0, or greater than the amount remaining
available to refund on the payment
InvalidPaymentId: requesting to refund a payment that does not exist
ChargeDisputed: Payment session has a pending dispute. Can’t refund until the dispute is
resolved. Lost disputes reduce the remaining refundable amount but no longer block refunds
of the undisputed remainder.
NoSessionCaptures: The payment session can’t be refunded because there haven’t been any
funds captured.
message:
- Indication of one of the following:
- Which field was missing
- Details on how the amount was invalid
- Invalid payment id