locked
About Paypal RRS feed

  • Question

  • User1256512446 posted

    Hi all:

    I have a paypal button. I try to test it in sandbox. My script is:

                                sbparametros.Append("cmd=_xclick")
                                sbparametros.Append("&business=martin@cresolia.com")
                                sbparametros.Append("&amount=" & importe_articulo("importe"))
                                sbparametros.Append("&item_number=" & referencia_articulo())
                                sbparametros.Append("&item_name=" & nombre_articulo("nombre"))
                                sbparametros.Append("&quantity=" & nombre_articulo("cantidad"))
                                If trpuntos.Visible Then sbparametros.Append("&discount_amount=" & descuento_empresa())
                                sbparametros.Append("&tax=" & importe_articulo("iva"))
                                sbparametros.Append("&currency_code=EUR")
                                sbparametros.Append("&lc=ES")
                                sbparametros.Append("&return=" & poner_paypal_return())
                                sbparametros.Append("&cancel_return=" & poner_paypal_cancel_return())
                                sbparametros.Append("&no_shipping=1")
                                sbparametros.Append("&cbt=" & GetGlobalResourceObject("rgeneral", "pulsarparacontinuarelpago"))
                                'Response.Redirect("https://www.paypal.com/cgi-bin/webscr?" & sbparametros.ToString)
                                Response.Redirect("https://www.sandbox.paypal.com?" & sbparametros.ToString)
    

    It goes of to paypal. But when it try to redirect my pages it goes to the same hank you page in paypal, doesn't redirect to my pages

    What happens?  Miss I anything? Maybe it is the call to Sandbox.

    TIA

    Tuesday, January 5, 2016 9:12 AM

All replies

  • User177399542 posted

    Hi Volar

                   Auto return feature is by default turned off in paypal. Enable auto return feature.

    For More info: http://stackoverflow.com/questions/7642895/setting-paypal-return-url-and-making-it-auto-return

    Tuesday, January 5, 2016 10:56 AM
  • User1256512446 posted

    Hi again:

    Thanks. I know now where to specify autoreturn

    Now my doubt is if I have to specify twice my url return, in my pages and in paypal.

    I use variables that need the aspx page to know their value.

    TIA

    Tuesday, January 5, 2016 12:02 PM
  • User1256512446 posted

    Hi:

    I have read the url in the button is the url it tries to return.

    I ask if I have to have my pages on internet to try the sanbox because I give a logical url, not physical

    Can u help me?

    TIA

    Tuesday, January 5, 2016 12:20 PM
  • User1256512446 posted

    Hi:

    These are the functions of return. U seeI use logical path, not physical.

        Function poner_paypal_cancel_return() As String
            Dim strenlace As String
            strenlace = "graciaspublicarobras.aspx?" & Request.QueryString.ToString & "&titulo=" & Master.Page.Title
            strenlace &= IIf(ddlmodos.Enabled, "&pagos=" & ddlmodos.SelectedValue, "")
            Return Server.UrlEncode(strenlace)
        End Function
    
        Function poner_paypal_return() As String
            Dim strenlace As String, intobra As Integer = ddlclasesobras.SelectedValue, cphcontenido As ContentPlaceHolder = Master.FindControl("cphcontenido")
            strenlace = "graciaspublicarobras.aspx?" & Request.QueryString.ToString & "&titulo=" & Master.Page.Title & IIf(Request.Cookies("cuenta") IsNot Nothing, "&obra=" & intobra, "") & "&id0=" & ddlobras.SelectedValue & "&tiposobras=" & ddltiposobras.SelectedValue & "&ttiposobras=" & ddltiposobras.SelectedItem.Text & "&idiomas=" & ddlidiomas.SelectedValue & "&tidioma=" & ddlidiomas.SelectedItem.Text & "&modospublicacion=" & ddlmodospublicacion.SelectedValue & "&npublicaciones=" & ddlnpublicaciones.SelectedValue & "&que=" & txtque.Text & IIf(tdregistro1.Visible, "&registro=" & txtregistro.Text, "")
            If locprueba.Visible Then strenlace &= "&prueba=" & Replace(Replace(Server.HtmlEncode(locprueba.Text), "<span class=""centrado"">", "*span class=""centrado""*"), "</span>", "*/span*")
            If trpublicacionprivada.Visible Then
                Dim strfichero As String, strextension As String
                If fufichero.HasFile Then
                    strfichero = fufichero.PostedFile.FileName
                    strextension = Path.GetExtension(strfichero).ToLower
                    strfichero = Left(strfichero, InStrRev(strfichero, ".") - 1)
                    strfichero = Left(strfichero, 21) & strextension
                    strenlace &= "&fichero=" & strfichero
                    If lblfichero.Text <> "" Then strenlace &= "&fichero_anterior=" & lblfichero.Text
                Else
                    strenlace &= "&fichero=" & lblfichero.Text
                End If
                strenlace &= "&importepublicacion=" & txtimportepublicacion.Text
            End If
            If pnldatos.Visible Then strenlace &= "&seudonimo=" & txtseudonimo.Text & "&contrasena=" & txtcontrasena.Text & "&nombre=" & txtnombre.Text & "&apellidos=" & txtapellidos.Text & "&correo=" & txtcorreo.Text & "&regiones=" & ddlregiones.SelectedValue & "&tregiones=" & ddlregiones.SelectedItem.Text & "&tpaises=" & ddlpaises.SelectedItem.Text
            If pnlotrosdatos.Visible Then strenlace &= "&direccion=" & txtdireccion.Text & "&localidad=" & txtlocalidad.Text & "&tipoidentificaciones=" & ddltiposidentificaciones.SelectedValue & "ttipoidentificaciones=" & ddltiposidentificaciones.SelectedItem.Text & "&identificacion=" & txtidentificacion.Text
            If chkffiscal.Checked Then strenlace &= "&nombre_factura=" & txtnombre_factura.Text & "&apellidos_factura=" & txtapellidos_factura.Text & "&tipoidentificaciones_factura=" & ddltiposidentificaciones_factura.SelectedValue & "ttipoidentificaciones_factura=" & ddltiposidentificaciones_factura.SelectedItem.Text & "&identificacion_factura=" & txtidentificacion_factura.Text & "&direccion_factura=" & txtdireccion_factura.Text & "&localidad_factura=" & txtlocalidad_factura.Text & "&regiones_factura=" & ddlregiones_factura.SelectedValue & "&tregiones_factura=" & ddlregiones_factura.SelectedItem.Text & "&paises_factura=" & ddlpaises_factura.SelectedValue & "&tpaises_factura=" & ddlpaises_factura.SelectedItem.Text
            strenlace &= "&importe=" & DirectCast(rptimporte.Items(0).FindControl("litimporte"), Literal).Text & "&iva=" & Left(DirectCast(rptimporte.Items(0).FindControl("litiva"), Literal).Text, InStr(DirectCast(rptimporte.Items(0).FindControl("litiva"), Literal).Text, "%") - 1) & "&total=" & DirectCast(rptimporte.Items(0).FindControl("littotal"), Literal).Text
            If trpuntos.Visible Then strenlace &= "&puntos=" & ddlusar.SelectedValue & "&puntosfinales=" & lblpuntosfinales.Text & "&puntosiniciales=" & lblpuntosiniciales.Text & "&importefinal=" & DirectCast(rptimporteconpuntos.Items(0).FindControl("litimporte"), Literal).Text & "&ivafinal=" & Left(DirectCast(rptimporteconpuntos.Items(0).FindControl("litiva"), Literal).Text, InStr(DirectCast(rptimporteconpuntos.Items(0).FindControl("litiva"), Literal).Text, "%") - 1) & "&totalfinal=" & DirectCast(rptimporteconpuntos.Items(0).FindControl("littotal"), Literal).Text
            If DirectCast(rptimporte.Items(0).FindControl("litimporte"), Literal).Text > 0 Then strenlace &= "&mensajepagos=" & Replace(Server.HtmlEncode(lblmensajepagos.Text), "<br />", "*br*") & "&modos=" & ddlmodos.SelectedValue & "&tmodos=" & ddlmodos.SelectedItem.Text
            strenlace &= "&monedas=" & ddlmonedas.SelectedValue & "&tmonedas=" & ddlmonedas.SelectedItem.Text & "&pagado=on"
            If rptcambio.Visible Then strenlace &= "&fcambio=" & DirectCast(rptcambio.Items(0).FindControl("lblcambio"), Label).Text & "&cotizacion=" & Mid(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, "=") + 1, InStr(InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, "=") + 1, DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, " ") - InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, "=") - 1) & "&divisa_empresa=" & Mid(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, " ") + 1, InStrRev(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, "=") - InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, " ") - 1) & "&divisa_plural=" & Mid(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, InStr(InStr(DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, "=") + 1, DirectCast(rptcambio.Items(0).FindControl("lblcotizacion"), Label).Text, " ") + 1)
            Return Server.UrlEncode(strenlace)
        End Function
    

    In this way, I  am addressing to paypal. But when it comes to redirect to my pages after the payment, it doesn't do it?

    Have I to give a pysical path to the return?

    TIA

    Tuesday, January 5, 2016 12:43 PM
  • User1256512446 posted

    Hi:

    As I supposed the url has to be physical, absolute.

    This seems I have to have my pages on  production to test the sandbox. Right?

    TIA

    Tuesday, January 5, 2016 12:48 PM
  • User1256512446 posted

    Hi again:

    I could do it.

    Now I get an error

    500 - Internal server error.
    
    There is a problem with the resource you are looking for, and it cannot be displayed.

    What does it mean?

    TIA

    Tuesday, January 5, 2016 2:17 PM
  • User1256512446 posted

    Hi again:

    The page I use for returning is a https. Can I do this return page in this protocol without any problem?

    TIA

    Tuesday, January 5, 2016 2:22 PM
  • User1686483761 posted

    You could ask the folllowing link for help.

    https://www.paypal-community.com/t5/US-PayPal-Community/ct-p/US

    Wednesday, January 6, 2016 6:31 AM