Forums / PayPal RESTful support / Display Fee amount in admin order comment?

Display Fee amount in admin order comment?

Views: 1,082

Results 1 to 3 of 3
18 Feb 2025, 4:22 PM
#1
apollowilcox avatar

apollowilcox

Zen Follower

Join Date:
Sep 2014
Location:
Indiana
Posts:
123
Plugin Contributions:
0

Display Fee amount in admin order comment?

Using 1.5.8a; Paypal Restful 1.0.4

When capturing a paypal payment, the admin order comment (which we have flagged as hidden) looks like:
*FUNDS CAPTURED. Trans ID: 3SD357xxxxxxxxx582M
Amount: 1.00 USD

Thank you for your order.*

Is there a way to add the paypal discount amount into this comment? For instance,
FUNDS CAPTURED. Trans ID: 3SD357xxxxxxxxx582M
Amount: 1.00 USD
Paypal fee: $0.32
Thank you for your order.

The comment is created in the \includes\modules\payment\paypal\PayPalRestful\Admin\DoCapture.php file, near line 93 but I was unable to find a variable containing the payment fee.

Thanks for any ideas.

18 Feb 2025, 7:43 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Display Fee amount in admin order comment?

apollowilcox:

Using 1.5.8a; Paypal Restful 1.0.4

When capturing a paypal payment, the admin order comment (which we have flagged as hidden) looks like:
*FUNDS CAPTURED. Trans ID: 3SD357xxxxxxxxx582M
Amount: 1.00 USD

Thank you for your order.*

Is there a way to add the paypal discount amount into this comment? For instance,
FUNDS CAPTURED. Trans ID: 3SD357xxxxxxxxx582M
Amount: 1.00 USD
Paypal fee: $0.32
Thank you for your order.

The comment is created in the \includes\modules\payment\paypal\PayPalRestful\Admin\DoCapture.php file, near line 93 but I was unable to find a variable containing the payment fee.

Thanks for any ideas.
At the point in that class where the $comments are created (line 92), the paypal fee can be formatted as

$capture_response['seller_receivable_breakdown']['platform_fee']['value'] . ' ' . $capture_response['seller_receivable_breakdown']['platform_fee']['currency_code']

See this PayPal API doc link for additional information: https://developer.paypal.com/docs/api/payments/v2/#authorizations_capture

19 Feb 2025, 6:18 PM
#3
apollowilcox avatar

apollowilcox

Zen Follower

Join Date:
Sep 2014
Location:
Indiana
Posts:
123
Plugin Contributions:
0

Re: Display Fee amount in admin order comment?

Thank you for that! I'm not much of a coder, so to be clear, should the comment creation starting at line 92 look like this?

        $comments =
            'FUNDS CAPTURED. Trans ID: ' . $capture_response['id'] . "\n" .
            "Amount: $amount\n" .
	    $capture_response['seller_receivable_breakdown']['platform_fee']['value'] . ' ' . $capture_response['seller_receivable_breakdown']['platform_fee']['currency_code'] . 
            $payer_note;

Testing this did not result in an error, but also did not present the fee. I'm probably missing something obvious...

Thanks.