Simply put a flexible check out paypal button using your own shopping cart.
one that sends each product plus quantity to the paypal payment page.
I've seen codes for multiple products, but those are not flexible. for example Payment for 2 unique items. but what about if the user buys X amount of different products? when only allows a fixed amount.
Referring to This page
Is this possible to do in PHP? If so I was thinking of something easy like an array listing each product with in the button form.
This would be possible. However, you would want to have some logic on your side that would check to see that amount that they are wanting to order and check it against your database to see the quantity that you have on hand. If they try to order more than you have on hand, you would give them a pop up telling that you only have x number on hand and that they can not order more than x amount. Then you would just populate the details and quantity that they ordered, and pass it over using the cart upload method similar to the example you provided.
Related
I want to make implement Cart funcionality in Laravel. I chose this plugin. But here and in many others cart packages I see that cart row stores not a product id but full information (product name, options, price). But what if the product title or product price was changed? Then the user still sees the old title (price) and it will cause some inconvienences to him. What I do not understand, why most cart packages store full information in cart row.
So what is the right way to store cart data: full info or by keys (product_id, option_id, ...)?
There is a preferred way to store cart information, and its the latter that you mentioned.
The reason for this is to not only increase the security of your shopping cart, but to also ensure that, as you rightly pointed out, customers are getting the right price, even after a change.
Typically what you want to do is store the product ID, any customisation options as well as a cart ID. Depending on the amount of products and the traffic you're receiving it may be unnecessary to work out the basket price each time a new page is loaded, and so typically you only work out a new price when a new product is added, taken away or modified; in addition to when the customer gets to the checkout area.
This serves several purposes,
the first is that is ensure that when the cart is directly changed by
a customer action, you can show an updated price.
The second is that you cut down the amount of calculations you have to do by a large amount by only changing the prices in the basket when something acts upon it.
You can ensure that customers cannot cheat the system by modifying the price, then going on to pay a different amount because you stored the price in the session.
I can't give you a more concrete answer because you've been fairly light on the specifics, but I hope this indicates the direction you should be heading in.
I have a website that list multiple items for sale. I would like to use paypal to sell stuff on it. The only problem is, when I have 1 item left, how can I avoid the clash if two people plan to buy it at the same time. Let's say Person A adds the item X to his cart. And after 30 second Person B adds the item to his Cart. Now person A is going to check out and is filling out his paypal information while Person B also presses checkout. How can I avoid that ? I know that I can remove the item from the listing the moment one of them is in the checkout stage, but again what If someone goes all the way to checkout page and just close his browser and never buy the item ? I appreciate it if anyone can suggest a solution that solves this issue and also give flexibility to people during shopping online.
If you create a hosted button on PayPal.com, under step 2 of button creation you can track inventory. Set the quantity to 1 or 2 or whatever you have in stock. Later you can change the quantity in stock by going to My Saved Buttons -> Action -> Edit Button.
If it's a unique item, start with quantity 1 and simply remove the button from your website once sold. People can't complete check out when there's 0 left in stock, so it's first come first served.
I have a website giving services for money, i just want a button goes to a paypal checkout page with a price specified by me. There is no product or service name, just website name and price. But i couldn't find something like that. I have too many different prices, so i can't create buttons for every price. Is it possible to define price as a variable in my webpage, and send paypal this? I use php.
Say i have a Laptop for 600.00. Say i change it to $650.00. How do shopping carts handle that? Like do they store the price in the cart or the item? How do they make sure they get the price they wanted but not bill the customer the new change without asking them? Or do most store them in both?
I was thinking maybe i could store it in both.
So if the current price is over the cart price for a item, don't remove it/bill them from their cart. Then after, tell them what was billed/email a receipt for the items that didn't change that was billed(say they had more then one item) and remove it from the cart. For the items that did change, say something like "Items left in cart due to price change, please check if you still want to buy the items at the new price." So leave the items that changed in the cart but update the price in the cart.
Thats my idea on how to do it. I don't think the language should matter. Guess this is more of a logical type question. Do most shopping carts do it this way or is there a better way?
Simple shopping carts are just arrays of products that are maintained through sessions and cookies. You can do anything you want. Just make sure users can't do anything they want such as change prices through the url. But most of all make it very, very, very easy for the user to checkout.
Most developers will create an array with product objects so if any changes are made to a product shopping carts will reflect this change. However, if you change your prices then obvious you will have a problem if a user clicks on on price but then you change it and the uses doesn't see this change until after they paid or become confused why the price went up mid shopping experience.
In terms of maintaining the line item if you have users sign in before they can add things to a cart then you don't need to worry about creating a cookie/session to store the array of the line items until they do checkout and the line items are saved with their information for later reference.
In this case what you will want to do is create a line item which is associated to the object so you can get all the products information but at the same time store the price in that actual LineItem model so if you do update your price it will not affect shoppers mid buying experience.
And if you want users to pay higher prices because you change your mind and want to use the line item model you can just do what is sated in the last paragraph and check the price right before a user decides to checkout. If it is different then let them no that this product is now x amount to purchase and don't forget to apologize.
The short answer, it all depends on how it was coded.
I assume the transaction that you are talking about is in process. If the price changes after the user completes the transaction, then it would be considered a "Bad Thing" in the terms of customer service, and may potentially be illegal in the eyes of your payments processor.
I like your idea of comparing the price in the cart vs the newest price. However if the user can change the value of the price of an item in the request to view the cart, it could cause many problems with what they actually get charged. For example, if the user changed the price of the laptop to $1200, and in your code you reduced the value in their cart by the difference, they could get that laptop for $0, which would be a "Bad Thing".
$1200 - User Input
$600 - Actual Price
-$600 - Adjustment against price
$0 - price customer is charged?
Another example would be if you make the price of the item a value that the user can edit, and they are a malicious user, they could potentially change the price to -$600.00, which again would be a "Bad Thing".
The more secure way to do it would be to store the item ID of the item in the cart in the link to view the cart, then retrieve/update the price of the item in the cart every time the properties (total, etc) of the cart are requested. That way if a malicious user tried the plus or minus trick, they would just get a message that the price has been updated to the "current price".
The OWASP site has some open source security tools that can help test your code against situations where the user tries to high jack a shopping cart. Their address is http://www.owasp.org
If the cart simply contains a reference to the item (such as the id/primary key), you don't need to store the price in two places at all. You simply load the objects from the cart when you need them, and prices will automatically reflect the change. In most cases, the changes will be infrequent enough that it is not a big deal from a user perspective.
I'm working on a site that will create pre-set packages of items. To start, I'm using Amazon to test the idea, pulling some affiliate sales, and then I'll fulfill orders myself if the idea deems successful.
My goal is to have a "buy now" type button, and upon clicking, the user will arrive at an Amazon checkout now page, with a cart pre-filled with items of my choosing, and my affiliate number.
I'm a PHP developer, so if a solution must be language specific, that's the language to go with. If it's more of a conceptual answer, or if there's an API for this, that works too.
You may use link that contains ASINs and their quantity. It doesn't add items to someone's cart but confirms to add to cart.
URL:
http://www.amazon.com/gp/aws/cart/add.html
Parameters:
- AssociateTag
- ASIN.<number> <number> starts at 1
- Quantity.<number> one quantity parameter for each ASIN parameter
Example (parameters separated by line break for visibility):
http://www.amazon.com/gp/aws/cart/add.html
?AssociateTag=your-tag
&ASIN.1=B003IXYJYO
&Quantity.1=2
&ASIN.2=B0002KR8J4
&Quantity.2=1
&ASIN.3=B0002ZP18E
&Quantity.3=1
&ASIN.4=B0002ZP3ZA
&Quantity.4=2
One line example: https://www.amazon.com/gp/aws/cart/add.html?AssociateTag=your-tag&ASIN.1=B003IXYJYO&Quantity.1=2&ASIN.2=B0002KR8J4&Quantity.2=1&ASIN.3=B0002ZP18E&Quantity.3=1&ASIN.4=B0002ZP3ZA&Quantity.4=2&ASIN.5=B004J2JG6O&Quantity.5=1
ASINs are found in the product's page URL or by searching for "ASIN" on the product page. More details here
Amazon does not allow you to add items to someone's cart. They require that the user making the purchase click the add to cart button.
The best you can do for this is to create a Listmania! list with the items. You can see more details about how to do that here.
You then need to make an affiliate link to the list, and instruct the user to click the 'Add all Items to Cart' button at the bottom of the list.
Unfortunately, there is no way to make this take less clicks for the user since Amazon does not want users accidentally purchasing items they did not want.