close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart not passing Discount to PayPal

Thread began 12/14/2011 7:53 am by Nathon Jones Web Design | Last modified 10/16/2013 11:36 am by Jason Byrnes | 3123 views | 14 replies |

Nathon Jones Web Design

eCart not passing Discount to PayPal

We're using ASP/VBScript, DW 8.0.2 and eCart 4.5.2.

We have the following form submitting to PayPal from our view-basket.asp page:

<form action="https://www.paypal.com/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="ourpaypalaccount@ourdomain.com">
<%SFCcart_Index = SFCcart.DisplayIndex - 2%>
<%
while (NOT WA_eCart_EOF(SFCcart))
%>
<%SFCcart_Index = SFCcart_Index + 1%>
<% 'WA eCart Validation
if ((WA_eCart_FormatNumber(WA_eCart_DisplayInfo(SFCcart, "Price") - ((WA_eCart_DisplayInfo(SFCcart, "Price")/WA_eCart_TotalColumn(SFCcart, "TotalPrice")) * WA_eCart_GetDiscounts(SFCcart)), false, 2) > 0)) then
%>
<input type="hidden" name="item_name_<%=SFCcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(SFCcart, "Name")%><%IF WA_eCart_DisplayInfo(SFCcart, "Colour") <> "" Then%>&nbsp;(<%=WA_eCart_DisplayInfo(SFCcart, "Color")%>)<%End IF%><%IF WA_eCart_DisplayInfo(SFCcart, "Size") <> "" Then%>&nbsp;(<%=WA_eCart_DisplayInfo(SFCcart, "Size")%>)<%End IF%>">
<input type="hidden" name="amount_<%=SFCcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(SFCcart, "Price")%>">
<input type="hidden" name="quantity_<%=SFCcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(SFCcart, "Quantity")%>">
<% 'WA eCart Validation
else
SFCcart_Index = SFCcart_Index - 1
end if
%>
<%
set SFCcart = WA_eCart_MoveNext(SFCcart)
wend
set SFCcart = WA_eCart_MoveFirst(SFCcart)
%>
<input type="hidden" name="shipping_1" value="5">
<input type="hidden" name="shipping2_1" value="0">
<input type="hidden" name="currency_code" value="GBP">
<input name="CheckoutButton" type="image" value="Proceed to Checkout" src="stranraer-fc/btn-checkout.png" onmouseover="this.src='plugins/stranraer-fc/btn-checkouton.png'" onmouseout="this.src='plugins/stranraer-fc/btn-checkout.png'" alt="Proceed to secure checkout" border="0" />
</form>

We have a discount rule set up in our cart to deduct 10% from the sub-total amount, to give us a grand total, but we've noticed that this amount isn't being passed to PayPal. Instead, our form is simply passing the individual product prices to PayPal.

How do we pass the individual items to PayPal whilst, at the same time, passing the correct grand total amount (sub-total - discounts)?

Again, I've attached our view-basket.asp page and cart files.

Thank you.
Regards
nath.

Attached Files
view-basketaspvb-stranraerfc.zip
Sign in to reply to this post

Nathon Jones Web Design

update?

You can check this out, online, at www.stranraerfcshop.com.

Any ideas though? This is causing us quite a few problems at the moment. Hope to hear from you. Thank you.

Nath.

Sign in to reply to this post

Jason ByrnesWebAssist

change:

<input type="hidden" name="shipping_1" value="5">



to:

<input type="hidden" name="discount_amount_cart" value="<%=WA_eCart_GetDiscounts(SFCcart)%>">
<input type="hidden" name="shipping_1" value="5">
Sign in to reply to this post

Nathon Jones Web Design

Charges?

How do I pass charges to PayPal in a similar fashion to how I've passed the discount?

I can't see anything in the PayPal documentation relating to charges, but perhaps I'm looking in the wrong place:
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

Would appreciate any advice offered. Thank you.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

no, poaypal does not offer a way to pass the charges.

you could use the custom element that they offer:
<input type="hidden" name="custom" id="custom" value="<%=WA_eCart_GetCharges(SFCcart)%>" />

Sign in to reply to this post

Nathon Jones Web Design

not passing to PayPal

Hi Jason,

That's not passing anything to PayPal. Here's my form...

<form action="https://www.paypal.com/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="ouremail@paypal.comk">
<%BFcart_Index = BFcart.DisplayIndex - 2%>
<%
while (NOT WA_eCart_EOF(BFcart))
%>
<%BFcart_Index = BFcart_Index + 1%>
<% 'WA eCart Validation
if ((WA_eCart_FormatNumber(WA_eCart_DisplayInfo(BFcart, "Price") - ((WA_eCart_DisplayInfo(BFcart, "Price")/WA_eCart_TotalColumn(BFcart, "TotalPrice")) * WA_eCart_GetDiscounts(BFcart)), false, 2) > 0)) then
%>
<input type="hidden" name="item_name_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Name")%>">
<input type="hidden" name="item_number_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "BFitemcode")%>/<%=WA_eCart_DisplayInfo(BFcart, "SKUcode")%>">
<input type="hidden" name="on0_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise1TITLE")%>">
<input type="hidden" name="os0_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise1")%>">

<%IF WA_eCart_DisplayInfo(BFcart, "Personalise2") <> "" Then%>
<input type="hidden" name="on1_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise2TITLE")%>">
<input type="hidden" name="os1_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise2")%>">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "Personalise3") <> "" Then%>
<input type="hidden" name="on2_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise3TITLE")%>">
<input type="hidden" name="os2_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise3")%>">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "Personalise4") <> "" Then%>
<input type="hidden" name="on3_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise4TITLE")%>">
<input type="hidden" name="os3_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise4")%>">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "Personalise5") <> "" Then%>
<input type="hidden" name="on4_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise5TITLE")%>">
<input type="hidden" name="os4_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise5")%>">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "Personalise6") <> "" Then%>
<input type="hidden" name="on5_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise6TITLE")%>">
<input type="hidden" name="os5_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Personalise6")%>">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "AddGiftWrap") = 1 Then%>
<input type="hidden" name="on6_<%=BFcart_Index+1%>" value="Gift Wrap">
<input type="hidden" name="os6_<%=BFcart_Index+1%>" value="Yes">
<%End IF%>

<%IF WA_eCart_DisplayInfo(BFcart, "MessageGiftWrap") <> "" Then%>
<input type="hidden" name="on7_<%=BFcart_Index+1%>" value="Gift Wrap Message">
<input type="hidden" name="os7_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "MessageGiftWrap")%>">
<%End IF%>

<input type="hidden" name="amount_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Price")%>">
<input type="hidden" name="quantity_<%=BFcart_Index+1%>" value="<%=WA_eCart_DisplayInfo(BFcart, "Quantity")%>">
<% 'WA eCart Validation
else
BFcart_Index = BFcart_Index - 1
end if
%>
<%
set BFcart = WA_eCart_MoveNext(BFcart)
wend
set BFcart = WA_eCart_MoveFirst(BFcart)
%>
<input type="hidden" name="shipping_1" value="<%=WA_eCart_GetShipping(BFcart)%>">
<input type="hidden" name="shipping2_1" value="0">
<input type="hidden" name="discount_amount_cart" value="<%=WA_eCart_GetDiscounts(BFcart)%>">
<input type="hidden" name="custom" id="custom" value="<%=WA_eCart_GetCharges(BFcart)%>" />
<input type="hidden" name="currency_code" value="GBP">
</form>

Have PayPal dropped the custom option do you think?
Thanks again.
NJ

Sign in to reply to this post

Jason ByrnesWebAssist

maybe try using this instead:
<input type="hidden" name="on0" value="Charges">
<input type="hidden" name="os0" value="<%=WA_eCart_GetCharges(BFcart)%>">

Sign in to reply to this post

Nathon Jones Web Design

Already exists...

I already have an on0 and os0 field. Won't that conflict?

Sign in to reply to this post

Jason ByrnesWebAssist

you have on0_<%=BFcart_Index+1%> fields, those are used for passing item options, they include an item index.

using "on0" without an index is used for passing order options.

Sign in to reply to this post

Nathon Jones Web Design

Nothing doing...

Ah, I see, sorry. I've just given that a try though and it's not working. When I get to PayPal the on0 and os0 field isn't being picked up.

Kind of worried that this isn't going to be possible yet it's crucial to the operation of this websites' shopping cart application. :o(
Hopefully there will be a way around this! Any ideas?

Much appreciated, as ever.
Regards
NJ

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...