Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Ads  
OnyakTech
 


  Sponsors  

Meet Our Sponsors

The Official Microsoft ASP.NET Website
Portal Webhosting - Hosting For Developers
Red-Gate Software
MaximumASP
SourceGear - Tools for Developers
.: CounterSoft :.
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  Problems with PayPal in DNN
Previous Previous
 
Next Next
New Post 7/13/2008 12:05 PM
User is offline RDO
56 posts
10th Ranked


Problems with PayPal in DNN 

I am needing to have a button to subscribe thru PayPal.com. Below is my .vb pagebehind. Currently it only refreshes the page without going to PayPal.


        Protected Sub Subscription_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Subscription.Click
            Response.Write(PayPalPostform0().ToString)
            End Sub
        Public Function PayPalPostform0() As String
            Dim PostUrl As String = "https://www.paypal.com/cgi-bin/webscr"
            Dim Cmd As String = "_xclick-subscriptions"
            Dim no_shipping As String = "1"
            Dim BusinessEmail As String = ___________@truvista.net"
            Dim Currency As String = "USD"
            Dim ItemName As String = school
            Dim a3 As String = subPrice
            Dim ret As String = "http://www._____________/desktopmodules/pgt/Payment_success.aspx"
            Dim cancel As String = "http://www.______________"
            Dim Note As String = "1"
            Dim p3 As String = subTerm1
            Dim t3 As String = subTerm2
            Dim bn As String = "PP-SubscriptionsBF"
            Dim lc As String = "US"
            Dim src As String = "1"
            Dim sra As String = "1"
            'Create the form to write to the page with PayPal parameters
            Dim ppform As New StringBuilder
            ppform.Append("<form name=" + """" + "frmPP" + """" + " id=" + """" + "frmPP" + """" + " action=" + """" + PostUrl + """" + " method=" + """" + "post" + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "cmd" + """" + " value=" + """" + Cmd + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "business" + """" + " value=" + """" + BusinessEmail + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "item_name" + """" + " value=" + """" + ItemName + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "no_shipping" + """" + " value=" + """" + no_shipping + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "return" + """" + " value=" + """" + ret + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "cancel_return" + """" + " value=" + """" + cancel + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "no_note" + """" + " value=" + """" + Note + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "currency_code" + """" + " value=" + """" + Currency + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "lc" + """" + " value=" + """" + lc + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "bn" + """" + " value=" + """" + bn + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "a3" + """" + " value=" + """" + a3 + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "p3" + """" + " value=" + """" + p3 + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "t3" + """" + " value=" + """" + t3 + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "src" + """" + " value=" + """" + src + """" + ">")
            ppform.Append("<input type=" + """" + "hidden" + """" + " name=" + """" + "sra" + """" + " value=" + """" + sra + """" + ">")
            Return ppform.ToString
            Me.PayPalPostScript(Page)

        End Function

        Private Sub PayPalPostScript(ByVal Page As System.Web.UI.Page)
            'This registers Javascript to the page which is used to post the PayPal form details
            Dim strScript As New StringBuilder()
            strScript.Append("<script language='javascript'>")
            strScript.Append("var ctlform = document.getElementById('frmPP');")
            strScript.Append("ctlform.submit();")
            strScript.Append("</script>")
            Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "PPSubmit", strScript.ToString)
        End Sub

 
New Post 7/13/2008 10:51 PM
User is offline Wes Tatters
410 posts
8th Ranked




Re: Problems with PayPal in DNN 

Because of the way asp.net works its not really possible to inject a second form into a page - asp.net gets pretty funny about this sort of stuff.

There are some discussion threads on these forumns that discuss ways to do the submit with paypal ... there are some workaround tricks
 - I have got it working using  using GET and a URL redirect which is possibly the cleanest solution.

Basically build a URL string and call paypal with a Response.Redirect( strPayPalURL, True)

 

 

Have also seen some success with a IFRAME type solution but this does tend not to scale very well - you could also look possibly at an AJAX based approach.

Westa

 
New Post 7/14/2008 12:22 AM
User is offline RDO
56 posts
10th Ranked


Re: Problems with PayPal in DNN 

Thank you Wes. I am very familiar with the forms issue in .net. The code I posted is actually from one of my other site and works fine in .net 2.0 however it is not working in my DNN Module. I was looking at some other posts and found a way of placing it in the .ascx which works fine (below) but I need to be able to have it in the pagebehing inorder to accomplish some other coding requirements.

Does anyone know how to get this to work in .vb pagebehind

 <input name="cmd" type="hidden" value="_xclick-subscriptions" />
            <input name="business" type="hidden" value="________@________ />
            <input name="item_name" type="hidden" value="school" />
            <input name="no_shipping" type="hidden" value="1" />
            <input name="return" type="hidden" value="http://www._______________/dnn/desktopmodules/pgtl/Payment_success.aspx" />
            <input name="no_note" type="hidden" value="1" />
            <input name="currency_code" type="hidden" value="USD" />
            <input name="lc" type="hidden" value="US" />
            <input name="bn" type="hidden" value="PP-SubscriptionsBF" />
            <input name="a3" type="hidden" value="99.99" />
            <input name="p3" type="hidden" value="6" />
            <input name="t3" type="hidden" value="M" />
            <input name="src" type="hidden" value="1" />
            <input name="sra" type="hidden" value="1" />
            <input align="absMiddle" alt="Subscribe" name="go" onclick="document.getElementById('form').action='https://www.paypal.com/cgi-bin/webscr';document.getElementById('form').target='_blank'"
                src="../images/football-subscribe.gif" type="image" value="Go" />

 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  Problems with PayPal in DNN
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Icthus Technologies
Building Faith on the Internet
www.icthustech.com
Efficion Consulting
A premier DotNetNuke consulting firm providing complete DNN services including: custom module development, skinning and design, installation and integration services.
www.efficionconsulting.com
DotNetNuke Training by Engage Software
Specializing in customized training, architecture and module solutions for large scale implementations lead by DNN Core Team Member Christopher Hammond.
engagesoftware.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP