Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
There is a problem when sending multiple items to paypal. Here is an example:
Item 1: price $10, quantity 1
Item 2: price $25, quantity 2
Item 1: price $100, quantity 3
In this case the total price should be: $10 + $25 * 2 + $100 * 3 = $360. When arriving on the paypal payment site the price is however $1010.
The problem seems to be in the paypal_payment_pps.module, see the code below:
foreach ($payment->line_items as $line_item) {
$data['amount_' . $index] = $line_item->totalAmount(TRUE);
$data['item_name_' . $index] = $line_item->name;
$data['quantity_' . $index] = $line_item->quantity;
$index++;
}
Changing $line_item->totalAmount(TRUE) with $line_item->unitAmount(TRUE) seems to have solved the problem.
Comment | File | Size | Author |
---|---|---|---|
#1 | paypal-payment-wrong-amount-2348087-1.patch | 721 bytes | Alex Dicianu |
Comments
Comment #1
Alex Dicianu CreditAttribution: Alex Dicianu commentedPatch attached.
Comment #2
XanoThe API docs are a bit fuzzy on this, but it looks like you are right.
Thanks!
Comment #3
XanoGreat, thanks again!