0

How do I save and show the credit card fee on the order page. When I get the response from the gateway I too get the credit card fee amount but it's not being added to the order and isn't viewable anywhere - does anyone have any experience with that?

5
  • Just clarifying... the actual credit card fee comes back in a response from the gateway and you want to add that to the order for the customer to pay? Seems like an odd workflow.
    – Brad Bell
    Oct 20 '16 at 22:09
  • I'm probably not making myself clear. The fee is paid on checkout through the gateway and is added to the total cost. I would like to register the fee on the final order in the CP. If the product cost $100 the total withdraw would be $100 + fee of $1 - total of $101. My question is - would I use adjusters or is there a better solution?
    – Beuschau
    Oct 20 '16 at 22:20
  • Which gateway adds the fee to the payment after you send them the amount to charge? Oct 21 '16 at 6:55
  • Epay.dk - if a customer wants to pay with credit card there's a fee. A Danish credit card adds an extra cost of DKK 1,39 to every withdraw. The Webshop can chose to pay the fee or put it on the customer. If you choose to use international credit card the fee is different. In the gateway response there's a txnfee variable with the fee amount. You can see it in action here - it's in Danish. Http://ef.18digital.dk.
    – Beuschau
    Oct 21 '16 at 7:41
  • Another question could be - how do I save all the response data from the gateway and make it viewable in the CP?
    – Beuschau
    Oct 21 '16 at 20:54
1

I would save the response to an incognito field (or fields) on your order (probably both the entire response and also just the fee separate out).

https://github.com/mmikkel/IncognitoField-Craft

The readonly incognito field is particularly good for this sort of thing - I use a bunch of these fields in a debug tab on my order layout to save useful things.

Just create the fields, add the fields to your order, and you update the values with the usual <input name="fields[fieldName]"> syntax with any cart operation, or use setContentFromPost if you're in a plugin:

    $order->setContentFromPost(array(
        'fieldName' => $creditCardFee,
    ));
    craft()->commerce_orders->saveOrder($order);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.