Surcharges via REST Api
Fooman Surcharges will automatically appear in REST responses for individual orders/invoices/creditmemos under the extension_attributes key.
For example the below response for salesOrderRepositoryV1Get will list the surcharges under extension_attributes > fooman_total_group > items:
Creating Refunds for Orders with Surcharges
By default when creating a creditmemo the whole surcharge amount will be refunded. If you wish to adjust the amount to a lower amount you can append an amount override to the REST Api url like the below:
?creditmemo[fooman_surcharge][payment1]=3.50
where payment1 is the type id as seen in the previous API response.
So the full url would be something like this
/V1/order/:orderId/refund?creditmemo[fooman_surcharge][payment1]=3.50
for offline payment methods. And this for creating an online refund:
/V1/invoice/:invoiceId/refund?creditmemo[fooman_surcharge][payment1]=3.50
Which results in