Link to home
Start Free TrialLog in
Avatar of lshane
lshane

asked on

PayPal Integration: Sending multiple dynamic items to PayPal

DWMX
WIN XP PRO
MS Access
Classic ASP VBScript

Hello.  I have created a very small shopping cart that uses session variables and pulls the product information from an MS Access db.  I'm at the "Checkout" page now and need to send these items to PayPal for purchase.  I am not sure how to do that.  I found code on the PayPal Integration site, but I am not sure how to make sense of it.  Even the examples for the "Multiple Items" scenarios look like they are manually generated, but I need to send my current individual items from a session variable.

(To view currently, the website is <http://www.alholley.com/al2/music_details.asp?projID=igim>)
Just "Add to cart" to see how it's working.

I really need some help.  Here is the PayPal Integration code I located for "Individual Items"
==============================================================================
<form action="https://www.paypal.com/us/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="you@youremail.com">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="amount" value="0.00">
<input type="image" src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
==============================================================================
==============================================================================
Here is the code that displays my product information on the "Checkout" page:

<table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr bgcolor="#FFFFCC">
              <td><font size="2" face="Verdana"><strong>ID</strong></font></td>
              <td><font size="2" face="Verdana"><strong>Product</strong></font></td>
              <td align="center"><font size="2" face="Verdana"><strong>Price</strong></font></td>
              <td align="center"><font size="2" face="Verdana"><strong>Quantity</strong></font></td>
            </tr>
            <tr bgcolor="#FFFFCC">
              <td colspan="4"><hr></td>
              </tr>

<%
FOR x = 0 TO UBOUND( localCart, 2 )
IF localCart( CARTPID, x ) <> "" THEN
orderTotal = orderTotal + ( localCart( CARTPPRICE, x ) * localCart( CARTPQUANTITY, x ) )

DIM chId,chProduct,chPrice,chQuantity
chId=(localCart( CARTPID, x) )
chProduct=Server.HTMLEncode( localCart( CARTPNAME, x ) )
chPrice=formatCurrency( localCart( CARTPPRICE, x ) )
chQuantity=localCart( CARTPQUANTITY, x )%>
            <tr bgcolor="#FFFFCC">
              <td><font size="2" face="Courier New, Courier, mono"><%=chId%></font></td>
              <td><font size="2" face="Courier New, Courier, mono"><%=chProduct%></font></td>
              <td align="center"><font size="2" face="Courier New, Courier, mono"><%=chPrice%></font></td>
              <td align="center"><font size="2" face="Courier New, Courier, mono"><%=chQuantity%></font></td>
            </tr>


<%
END IF
NEXT
%>
          </table>
==============================================================================

I need to pass the "chId,chProduct,chPrice,chQuantity" information, but I'm not sure how to do it.  I know on a "Single Item" button, I would use the "item_number" variable and give it a value of the recordset.  However, I'm not sure how to do this when multiple items are in play.

Thank you so much in advance,
Shane
ASKER CERTIFIED SOLUTION
Avatar of R_Harrison
R_Harrison
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry, on line 25 the REM should be "CLOSE LOOP HERE"
Avatar of lshane
lshane

ASKER

Thanks so much, R Harrison.