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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alex Dicianu’s picture

Patch attached.

Xano’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Active » Needs review

The API docs are a bit fuzzy on this, but it looks like you are right.

Thanks!

Xano’s picture

Status: Needs review » Fixed

Great, thanks again!

  • Xano committed 23bc048 on 7.x-1.x authored by dicix
    Issue #2348087 by dicix: Fixed Wrong amount sent to paypal.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.