PayPal ‘Adaptive Payments’ – ‘Chained Payments’

  • Posts: 11
  • Thank you received: 0
11 years 3 weeks ago #130257

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : x.x.x
-- Joomla version -- : x.x
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

Hi,
I am setting up PayPal ‘Adaptive Payments’ – ‘Chained Payments’ payments using the PayPal plugin.

This is from PayPal App approval people:

Can you confirm that the seller will be the Primary recipient in the Chained payment & you will collect your fees as Secondary recipient? We will require you to set up the payment in this way so that the seller is the Merchant of Record in the case of any Chargebacks or Refunds. You can always facilitate the refunds by using third party refund API. Please amend your selections in the ‘Services Used by App’ – ‘Adaptive Payments’ – ‘Chained Payments’ area of the submission form to reflect this. Note: You will need to click the App Name in the ‘My Applications' area in order to expand and edit the fields of your submission form.


During testing I see this:

array(11) {
["requestEnvelope"]=>
array(1) {
["errorLanguage"]=>
string(5) "en_US"
}
["actionType"]=>
string(3) "PAY"
["currencyCode"]=>
string(3) "USD"
["receiverList"]=>
array(3) {
[0]=>
array(3) {
["email"]=>
string(35) "This email address is being protected from spambots. You need JavaScript enabled to view it."
["amount"]=>
float(41.99)
["primary"]=>
string(4) "true"
}
[1]=>
array(3) {
["email"]=>
string(13) "This email address is being protected from spambots. You need JavaScript enabled to view it."
["amount"]=>
float(9)
["primary"]=>
string(5) "false"
}
[2]=>
array(3) {
["email"]=>
string(12) "This email address is being protected from spambots. You need JavaScript enabled to view it."
["amount"]=>
float(19.8)
["primary"]=>
string(5) "false"
}
}
["feePayer"]=>
string(13) "SECONDARYONLY"


Indicates that the store owner is Primary as well as the Vendors?

AND

How do I setup Shipping and/or Payments plugins so shipping fees that are charged are payed to the vendor and not retained by store owner? Sorry, I could not find documentation for this.

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 3 weeks ago #130295

Hi,

In the receiver list, you see only one "primary" account (the first one is set with "true", the others with "false").

For the shipping/payment fees, if you asked HikaMarket to split the fees, it will split to the different vendors depending to their cart total percentage. So if the main vendor is not selling any item, he won't pay anything for the shipping/payment fees.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 3 weeks ago #130304

Hi,
Thanks for the response.
I see now how the primary is defined.
This is the opposite of what I want and is recommended by PayPal.

Store owner = A (primary)
Vendor = B (Secondary)
So for instance B lists and sells something for 100
Buyer pays through PayPal to A 100
A pays 90% to B ( chained payment ) A keeps 10% ( commission or listing fee or whatever )
So if Buyer is unhappy and and demands a refund or charge back, A is responsible for 100% of that charge back even though they collected only 10% of the transaction.

This from PayPal:

so each item will initiate a chained payments. so if they buy 6 items, it will be six payments. the issue with chargebacks is, if you are the primary receiver of a payments for six items, if the buyer is not happen with one of the items, all six items payments will be charged back even the buyer is only questioning about a portion of the payments. this will be very risky. You can also do parallel payments, so the buyer see one payment to six people including you. If he has any question about any of the payment, he can contact that person directly. We definitely don't encourage you to be the primary receiver as you are only keep a small portion of the payment but your PayPal account will be responsible for all chargebacks and refund. You can always using refund API 3rd party permission to facilitate refunds from your merchant's account as you are the app caller and you owns the APP ID. thanks, Xiaolei


Is this something that can be changed? Is there a setting that I am missing?
Can you also include provision to issue refund via API as mentioned?

Thanks,
-Chris

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 3 weeks ago #130309

Hi,

It is not possible to put another account as primary if the other account does not have a special account compatible with "paypal adaptive". I tried and other users test it too, without success.
That's why it's not possible in the plugin to change the primary account, which is always your paypal adaptive account email.

But as paypal said, you can use parallel mode if you want. The plugin is compatible with this mode.
At this moment the customer can see the different vendors.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 3 weeks ago #130512

For the shipping/payment fees, if you asked HikaMarket to split the fees, it will split to the different vendors depending to their cart total percentage. So if the main vendor is not selling any item, he won't pay anything for the shipping/payment fees.

This does not seem to work is there another setting that controls this?
The shipping fees are not transferred to the vendor/s.

So the main vendor is not selling any items.
listing/commission is 10%
PayPal adaptive is set to parallel payments.

1 Item in cart price 10.00 + 6.00 shipping.
the split for payments is
main vendor = 7.00
vendor = 9.00

Should be
main vendor = 1.00 ( maybe 1.60 if the commission includes Shipping fees - I think it should not)
vendor = 15.00 (14.40)

So I have tried the combinations of
Split shipping fees No Yes
Shipping per vendor No Yes

Any ideas?

Thanks,
-Chris

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 3 weeks ago #130571

Hi,

And how the shipping fees are displayed in the backend orders ?
Does the sub-order for the vendor have the right shipping fees or are they set to 0 ?

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 2 weeks ago #130576

Hi,
The sub-order displays
Additional information
Subtotal $10.00
Coupon $0.00
Shipping $6.00 - Best Way
Payment fee $0.00 - PayPal
Total $16.00

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 2 weeks ago #130634

Hi,

So in your sub-order you right have the shipping price.
In the main order, you should see the "total vendor price" including this shipping fees, right ?

The paypal adaptive plugin does not process any special thing in the orders.
It uses the "vendor total prices" for the other vendors and let the rest of the order to the primary account.

So the best is to have a screenshot of your HikaMarket configuration and a screenshot of the order result.
I tried to reproduce your problem in my local website, but I didn't make it.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 2 weeks ago #130761

Hi Jerome,
Here are screen shots of Order, Vendor sub-Order, PayPal Payment, and HikaMarket Configuration.
If you need access to administrator login PM and I will setup a user for you.
If you want to test an order from the front end.
User fred
PW fred

Let me know if you need more info.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 2 weeks ago #130884

Hi,

If you look at the main order, you see the sub-orders list.
In this table, there is a column "vendor total" which is the total for the vendor (without yours fees).
The total is $9 but for what I understand, it should be $15

So, it is definitively not related to the paypal adaptive plugin but to the process which calculate the vendor total.
I am currently investigating the problem.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 2 weeks ago #130912

Hi,

I wrote some modification but before releasing it, I want to be sure that it will not have side effects.
You can apply this patch manually by modifying the file "administrator/components/com_hikamarket/classes/order.php" and replace:

public function calculateVendorPrice($vendor_id, &$products, &$fees, $coupon = null) {
By:
public function calculateVendorPrice($vendor_id, &$products, &$fees, $coupon = null, $v_order = null) {
Then:
			} elseif(bccomp($coupon->discount_percent_amount, 0, 5) !== 0) {
				$ret *= floatval((100 - floatval($coupon->discount_percent_amount)) / 100);
			}
		}

		return $ret;
	}
By
			} elseif(bccomp($coupon->discount_percent_amount, 0, 5) !== 0) {
				$ret *= floatval((100 - floatval($coupon->discount_percent_amount)) / 100);
			}
		}

		if(!empty($v_order)) {
			if(!empty($v_order->order_payment_price))
				$ret += $v_order->order_payment_price;
			if(!empty($v_order->order_shipping_price))
				$ret += $v_order->order_shipping_price;
		}

		return $ret;
	}
And the last one:
		if(empty($order->cart->coupon))
			$order->cart->coupon = null;

		$shopOrderClass->recalculateFullPrice($v_order, $v_order->cart->products);
		$v_order->order_vendor_price = $this->calculateVendorPrice($vendor_id, $v_order->cart->products, $fees, $order->cart->coupon);
By
		if(empty($order->cart->coupon))
			$order->cart->coupon = null;

		$shopOrderClass->recalculateFullPrice($v_order, $v_order->cart->products);
		$v_order->order_vendor_price = $this->calculateVendorPrice($vendor_id, $v_order->cart->products, $fees, $order->cart->coupon, $v_order);
These modification will "push" the shipping and payment fees into the vendor total price.
At this moment, the sub-order will have nicer data.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 2 weeks ago #130942

Hi Jerome,
In administrator/components/com_hikamarket/classes/order.php
I can not find

} elseif(bccomp($coupon->discount_percent_amount, 0, 5) !== 0) {
				$ret *= floatval((100 - floatval($coupon->discount_percent_amount)) / 100);
			}
		}

		return $ret;
	}
I have attached the file from my install.

Last edit: 11 years 2 weeks ago by Jerome.

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 2 weeks ago #130950

Hi,

It is at the end of the function "calculateVendorPrice" just before the function "processShippingParams".

Regards,

PS : Please do not attach HikaMarket files in the forum.


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 11
  • Thank you received: 0
11 years 2 weeks ago #130972

Sorry about the attachment,
OK,
I replaced this (different from what you have below)

} elseif(bccomp($coupon->discount_percent_amount, 0, 5) !== 0) {
				$ret *= floatval($coupon->discount_percent_amount / 100);
			}
		}

		return $ret;
	}
with
} elseif(bccomp($coupon->discount_percent_amount, 0, 5) !== 0) { 
 $ret *= floatval((100 - floatval($coupon->discount_percent_amount)) / 100); 
 } 
 }

if(!empty($v_order)) { 
 if(!empty($v_order->order_payment_price)) 
 $ret += $v_order->order_payment_price; 
 if(!empty($v_order->order_shipping_price)) 
 $ret += $v_order->order_shipping_price; 
 }

return $ret; 
 }
Seems to be working,

Thanks.

Please Log in or Create an account to join the conversation.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 2 weeks ago #130978

Good :)

I will continue my investigations, the patch (or something similar) would be in the next release.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.084 seconds
Powered by Kunena Forum