Open ideadude opened 2 years ago
Similar issue here {Moderators Only: #518735}
On a PayPal invoice when using either the VAT Tax Add-On or the custom code to add a tax % to checkout, the line regarding TAX is always set at 0
. PMPro does not send the TAX_AMT
to the PayPal API.
This customer fixed the API call to PPE with this bit of code below and is hoping we can include this in our next update.
function add_tax_and_item_paypalexpress($nvpStr, $order){
$initial_payment = $order->InitialPayment;
$initial_payment_tax = $order->getTaxForPrice($initial_payment);
$nvpStr .= "&ITEMAMT=".$initial_payment."&TAXAMT=". $initial_payment_tax;
return $nvpStr;
} add_filter( 'pmpro_set_express_checkout_nvpstr', 'add_tax_and_item_paypalexpress', 10, 3 ); add_filter( 'pmpro_do_express_checkout_payment_nvpstr', 'add_tax_and_item_paypalexpress', 10, 3 );
When processing a one time payment "charge", the PayPal Express integration adds the tax amount into the total and DOES NOT pass the tax as a separate value:
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L652
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L659-L662
However, when processing a subscription (including the initial payment, which happens in one API call with PayPal Express), we include the tax in the initial payment, but not in the recurring amount. We pass a separate tax amount for the recurring portion.
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L707
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L712
https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypalexpress.php#L720
Question: Why have we coded things this way? Can we break out the tax amount for one time payments and initial payments too? If not, we should note in code comments why we do things the way we do.
Also, the PayPal gateway class is slightly different and should be updated to work the same way. https://github.com/strangerstudios/paid-memberships-pro/blob/dev/classes/gateways/class.pmprogateway_paypal.php