Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Paypal button error

For some reason my Paypal button works when tested through my local server, but once I uploaded my site onto my FTP, I started getting an error message whenever I tried to add an item to my cart--the error message says: "PayPal cannot process this transaction because of a problem with the seller's website. Please contact the seller directly to resolve this problem."

Here's my form:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
            <input type="hidden" name="cmd" value="_s-xclick">
            <input type="hidden" name="hosted_button_id" value="<?php echo $product["paypal"]; ?>">
            <input type="hidden" name="item_name" value="<?php echo $product["name"]; ?>"> 
            <table>
            <tr>
                <th>
                    <input type="hidden" name="on0" value="Size">
                    <label for="os0">Size</label>
                </th>
                <td>
                <select name="os0" id="os0">
                    <?php foreach($product["sizes"] as $size) { ?>
                    <option value="<?php echo $size; ?>"><?php echo $size; ?> </option>
                    <?php } ?>
                </select> 
            </td></tr>
            </table>
            <input type="submit" value="Add to Cart" name="submit">
            </form>

Anything would help! I'm so close to finishing this up!

Thanks :)

1 Answer

That error is coming from Paypal. You probaby want to check the hosted_button_id value that's being generated.

Thanks for getting back to me, John. I went back and double checked that I used the correct paypal ID that was generated for that item, and it's correct. I just copy/pasted it into my products.php inventory page within the array for that item, so I'm not sure why I'm having an error here. Any other ideas?