Jump to content

Archived

This topic is now archived and is closed to further replies.

Lord_Azure

Restricting certain products from paypal payments

Recommended Posts

I run an adult orientated web site that Paypal does not like certain products I sell.

 

Is it possible to set certain products to only pay through an alternative payment or check/cheque?

 

Or is it possible to direct me in the right direction.

Share this post


Link to post
Share on other sites

@@lord_Azure

 

I don't believe there is a contribution that would allow that, however it wouldn't be too difficult to code it.

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

I am thinking of something similar, but I want certain products to be bought with only paypal ie virtual products. I will look into this more and let you know what I find.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Hazmat products addon (commercial) does something like this.

 

You set certain products "hazardous" and can then use that setting to do

things (eg, select special shipping, invoke an order_total, pay by paypal [or not], and so and so forth).


Help shape the future of Phoenix; join the Phoenix Club

Share this post


Link to post
Share on other sites

This looked like a good challange for the morning, so I threw this together on a fresh 2.3.X install

 

In checkout_payment.php find:

$selection = $payment_modules->selection();

After add this:

 $products = $cart->get_products();
 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
   $allowed_array = explode(',' , '134,145,15');
   if ((in_array($products[$i]['id'], $allowed_array))) {
  for($i=0, $n=sizeof($selection); $i<$n; $i++) {
    if($selection[$i]['id'] == 'paypal_express') {
	  array_splice($selection, $i, 1);
	  break;
    }
  }
   }
 }

 

What this does is check the product id in the cart, and if any of the ids match what is in the array then it will next check for which payment method should be excluded.

 

There may be a more elegant way of coding it, without so much looping, but it worked any way I tried it.

 

To Use:

On the line with $allowed_array = explode(',' , '134,145,15'); replace 134,145,15 with the product ids you want to exclude from payment method, all comma seperated.

 

Next:

On the line if($selection[$i]['id'] == 'paypal_express') { Replace paypal_express with the clas name of the payment method you are using. If your using paypal standard, the class name is paypal_standard

 

I didnt even try to make this work to skip PayPal express on the shopping_cart page, but something very simular would work.

 

I originally saw the $allowed_array code long ago in a nifty oscommerce cookbook by @@Monika in Germany


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

I run an adult orientated web site that Paypal does not like certain products I sell.

 

Is it possible to set certain products to only pay through an alternative payment or check/cheque?

 

Or is it possible to direct me in the right direction.

 

I know from past experience if paypal ever did get round to checking the website (maybe payment dispute) and they deemed certain products unsuitable they would just close your account even if 80-90-% were suitable and the account money possibly frozen for 6 months.

 

So you need to be careful you should instead be looking for payment provider who accepts adult content

 

You may get away with it for 1 - 2 years but you should definitely have a back up plan.

 

Regards

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

I have removed the offending products for now (disabled). Paypal has said that if I wish to continue with these products it would be fine, as long as the payments did not go through Paypal.

 

So the alternative option would be to allow them by cheque or postal order.

Share this post


Link to post
Share on other sites

Well if paypal allowed then nice they are getting better the last few years

 

I suppose you could the restrict payment for the items to maybe the alternative payment system moneybookers, bank transfer also being ones that spring to mind

 

Just putting all the eggs in one basket would not be advisable.

Best of luck

Joli


To improve is to change; to be perfect is to change often.

 

Share this post


Link to post
Share on other sites

What is the plan if the customer's basket has a mixture of items allowed and disallowed by a given payment system? I presume you're not going to ask for partial payment with one system and part with something else. So if there are any items banned by PayPal, you would remove PayPal from the list of possible payment systems? I think @Websource5 was trying to do something like that. What's your fallback if all your normal payment methods are rejected -- would you then allow a method (e.g., check, COD) you normally don't take? I would also be careful to offer an explanation of why any/all of your normal payment methods are excluded -- some people might have shopped with you because you offer certain payment methods (e.g., PayPal), and be ticked off at checkout time if that method is suddently not there! At a minimum, on pages of products that trigger this, something like "Sorry... PayPal and BitCoin cannot be accepted for a purchase of this product."

Share this post


Link to post
Share on other sites

@@14steve14

 

Not sure if you realize that PayPal does NOT have a seller protection policy for virtual products. There is rampant fraud when PayPal is used for non-tangible products.

 

 

 

Chris


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

This looked like a good challange for the morning, so I threw this together on a fresh 2.3.X install

 

In checkout_payment.php find:

$selection = $payment_modules->selection();

After add this:

$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
$allowed_array = explode(',' , '134,145,15');
if ((in_array($products[$i]['id'], $allowed_array))) {
 for($i=0, $n=sizeof($selection); $i<$n; $i++) {
 if($selection[$i]['id'] == 'paypal_express') {
	 array_splice($selection, $i, 1);
	 break;
 }
 }
}
}

 

What this does is check the product id in the cart, and if any of the ids match what is in the array then it will next check for which payment method should be excluded.

 

There may be a more elegant way of coding it, without so much looping, but it worked any way I tried it.

 

To Use:

On the line with $allowed_array = explode(',' , '134,145,15'); replace 134,145,15 with the product ids you want to exclude from payment method, all comma seperated.

 

Next:

On the line if($selection[$i]['id'] == 'paypal_express') { Replace paypal_express with the clas name of the payment method you are using. If your using paypal standard, the class name is paypal_standard

 

I didnt even try to make this work to skip PayPal express on the shopping_cart page, but something very simular would work.

 

I originally saw the $allowed_array code long ago in a nifty oscommerce cookbook by @@Monika in Germany

 

Is it possible to prevent the payment of another option too? i.e. I have Paypal, NoChex and Check. Is it possible to stop NoChex too.

 

I did try but i could only get 1 or the other to stop.

Share this post


Link to post
Share on other sites

@@14steve14

 

Not sure if you realize that PayPal does NOT have a seller protection policy for virtual products. There is rampant fraud when PayPal is used for non-tangible products.

 

 

 

Chris

 

Chris. I am fully aware of this. My downloads are so cheap, and I have never had any problems, so its not too bad.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Is it possible to prevent the payment of another option too?

 

Yes, it is, try this:

 

$products = $cart->get_products();
 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    $allowed_array = explode(',' , '134,145,15');
    if ((in_array($products[$i]['id'], $allowed_array))) {
	  for($i=0, $n=sizeof($selection); $i<$n; $i++) {
		    if($selection[$i]['id'] == 'paypal_express') {
			  array_splice($selection, $i, 1);
			  break;
		    }
	  }
	  for($i=0, $n=sizeof($selection); $i<$n; $i++) {
		    if($selection[$i]['id'] == 'paypal_express') {
			  array_splice($selection, $i, 1);
			  break;
		    }
	  }
    }
 }

or this may work better - (or not at all)

$products = $cart->get_products();
 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
    $allowed_array = explode(',' , '134,145,15');
    if ((in_array($products[$i]['id'], $allowed_array))) {
	  for($i=0, $n=sizeof($selection); $i<$n; $i++) {

             if($selection[$i]['id'] == 'paypal_express') {
			  array_splice($selection, $i, 1);
			  break;
		    }

		    if($selection[$i]['id'] == 'paypal_express') {
			  array_splice($selection, $i, 1);
			  break;
		    }
	  }
    }
 }

 

Again, change the class names, product id's, etc;

 

For each payment you want to exclude, repeat the pattern, I havent tested this, but I'm pretty sure the first example above will work, but if the second one works, then use it instead.


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

@ Following this with interest,

 

Is there a way to change this code so that only one or two payment methods are accepted for items with a value greater than "X"? (Namely Bank Transfer or Cheque).

 

some of my items are high value and the % applied on these for card / paypal transactions means I cant price competitively.

 

I was toying with another method but this one seems far simpler if it can be adapted.

 

Many Thanks


Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Share this post


Link to post
Share on other sites

Yes, it is, try this:

 

$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
 $allowed_array = explode(',' , '134,145,15');
 if ((in_array($products[$i]['id'], $allowed_array))) {
	 for($i=0, $n=sizeof($selection); $i<$n; $i++) {
		 if($selection[$i]['id'] == 'paypal_express') {
			 array_splice($selection, $i, 1);
			 break;
		 }
	 }
	 for($i=0, $n=sizeof($selection); $i<$n; $i++) {
		 if($selection[$i]['id'] == 'paypal_express') {
			 array_splice($selection, $i, 1);
			 break;
		 }
	 }
 }
}

or this may work better - (or not at all)

$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
 $allowed_array = explode(',' , '134,145,15');
 if ((in_array($products[$i]['id'], $allowed_array))) {
	 for($i=0, $n=sizeof($selection); $i<$n; $i++) {

if($selection[$i]['id'] == 'paypal_express') {
			 array_splice($selection, $i, 1);
			 break;
		 }

		 if($selection[$i]['id'] == 'paypal_express') {
			 array_splice($selection, $i, 1);
			 break;
		 }
	 }
 }
}

 

Again, change the class names, product id's, etc;

 

For each payment you want to exclude, repeat the pattern, I havent tested this, but I'm pretty sure the first example above will work, but if the second one works, then use it instead.

 

Thank you for your help. The second option will allow one of the payments through, which ever one you selected first, the second will stop the second but allow the first.

 

The first option works as it stops all transactions all together and only allows the Check / Money Order which is perfect.

 

This would be cool if you could set the Paypal option on product creation to save messing around. But I dont expect you to go that far. One final request however. I have tried entering a echo "Your cart contains a product which is not allowed through Paypal"; before the

array_splice($selection, $i, 1); but that didnt work. Any ideas?

Share this post


Link to post
Share on other sites

If fact, forget it, i got it to work, it was in the right place but not noticable.

 

by entering the line

print "<div class='errorBox'>You have items in your cart that are not allowed through Paypal or NoChex</div>";

 

It shows as an error and then people will know they cant do it.

Share this post


Link to post
Share on other sites

Try adding something like the following alert before the code, and then after the products array.

$pp-alert='';

$products = $cart->get_products();
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
	 $allowed_array = explode(',' , '134,145,15');

$pp-alert='Your cart contains a product which is not allowed through Paypal';

	 if ((in_array($products[$i]['id'], $allowed_array))) {
			 for($i=0, $n=sizeof($selection); $i<$n; $i++) {
					 if($selection[$i]['id'] == 'paypal_express') {
							 array_splice($selection, $i, 1);
							 break;
					 }
			 }
			 for($i=0, $n=sizeof($selection); $i<$n; $i++) {
					 if($selection[$i]['id'] == 'paypal_express') {
							 array_splice($selection, $i, 1);
							 break;
					 }
			 }
	 }
}

 

Then somewhere after, maybe at below the checkout methods table, just add:

<?php echo $pp-alert; ?>

 

Well hows that for timing? :)


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

@@Mort-lemur

 

have you tried making the product array choose ifnot? Instead of

 

if ((in_array($products[$i]['id'], $allowed_array)))

 

try

if (!(in_array($products[$i]['id'], $allowed_array)))


Follow the community build:

BS3 to osCommerce Responsive from the Get Go!

Check out the new construction:

Admin Gone to Total BS!

Share this post


Link to post
Share on other sites

×