skip to Main Content

https://developer.paypal.com/docs/archive/express-checkout/ht-ec-parallelPayments/

Been trying to implement this on ISS with ASP.Net & VB.Net and I am not sure how to properly build the request token so that this can work and be utilized.

This is what I have come up with, but the API request will not process getting this:

The request was aborted: Could not create SSL/TLS secure channel.


still not working

Private Sub btnSUBMIT_Click(sender As Object, e As EventArgs) Handles btnSUBMIT.Click

    Dim NVP As New Dictionary(Of String, String)  ''Api Name-Value-Pair parameters

    ''define paypal SANDBOX server
    Dim paypalApiServerUrl As String = "https://api-3t.sandbox.paypal.com/nvp"


    NVP.Add("USER", "fixed")   '                                                   = Caller_ID '## the PayPal User ID Of the caller account
    NVP.Add("PWD", "12345678")  '                                               PWD = Caller_Pswd '## the caller account Password
    NVP.Add("SIGNATURE", "solved")  '                                    Signature = Caller_Sig '## the caller account Signature
    NVP.Add("METHOD", METHOD)  '                                        METHOD = SetExpressCheckout '## API operation
    NVP.Add("RETURNURL", RETURNURL)  '                                     RETURNURL = https : //example.com/success.html '## URL displayed to buyer after authorizing transaction
    NVP.Add("CANCELURL", CANCELURL)  '                                    CANCELURL = https : //example.com/canceled.html '## URL displayed to buyer after canceling transaction 
    NVP.Add("Version", "93")  '                                                  Version = 93 '## API version
    NVP.Add("PAYMENTREQUEST_0_CURRENCYCODE", PAYMENTCURRENCYCODE)  '             ## Start primary level information For first payment                        
    NVP.Add("PAYMENTREQUEST_0_AMT", "250")  '                                     
    NVP.Add("PAYMENTREQUEST_0_ITEMAMT", "225")  '                                     
    NVP.Add("PAYMENTREQUEST_0_TAXAMT", "25")  '                                     
    NVP.Add("PAYMENTREQUEST_0_PAYMENTACTION", SALEPAYMENTACTION)  '                                     
    NVP.Add("PAYMENTREQUEST_0_DESC", PaymentDescription)  '                                     
    NVP.Add("PAYMENTREQUEST_0_SELLERPAYPALACCOUNTID", "[email protected]")  ' ## PayPal e-mail Of first receiver                                    
    NVP.Add("PAYMENTREQUEST_0_PAYMENTREQUESTID", "CIYP CART1")  '              PAYMENTREQUEST_0_PAYMENTREQUESTID = CART1 '## unique ID Of first payment – End primary level information For first payment                       
    NVP.Add("L_PAYMENTREQUEST_0_NAME0", "Super Sub CIYP")  '                    L_PAYMENTREQUEST_0_NAME0 = Super Sub '## Start secondary level information For first payment first item                 
    NVP.Add("L_PAYMENTREQUEST_0_NUMBER0", "SS - 101")  '                                     
    NVP.Add("L_PAYMENTREQUEST_0_QTY0", "1")  '                                     
    NVP.Add("L_PAYMENTREQUEST_0_AMT0", "125")
    NVP.Add("L_PAYMENTREQUEST_0_TAXAMT0", "15")  '                               ## End secondary level information For first payment first item      
    NVP.Add("L_PAYMENTREQUEST_0_NAME1", "Classic Wine Example")  '                      L_PAYMENTREQUEST_0_NAME1 = EXAMPLE Classic Wine '## Start secondary level information For first payment second item                
    NVP.Add("L_PAYMENTREQUEST_0_QTY1", "1")  '                                     
    NVP.Add("L_PAYMENTREQUEST_0_AMT1", "100")  '                                     
    NVP.Add("L_PAYMENTREQUEST_0_TAXAMT1", "10")  '                               ## End secondary level information For first payment second item                 
    NVP.Add("PAYMENTREQUEST_1_CURRENCYCODE", PAYMENTCURRENCYCODE)  '             ## Start primary level information For second payment                                   
    NVP.Add("PAYMENTREQUEST_1_AMT", "75")  '                                     ## total amount Of second payment           
    NVP.Add("PAYMENTREQUEST_1_ITEMAMT", "65")  '                                     
    NVP.Add("PAYMENTREQUEST_1_TAXAMT", "10")  '                                     
    NVP.Add("PAYMENTREQUEST_1_PAYMENTACTION", SALEPAYMENTACTION)  '                                     
    NVP.Add("PAYMENTREQUEST_1_DESC", "Mocktail Large")  '                                     
    NVP.Add("PAYMENTREQUEST_1_SELLERPAYPALACCOUNTID", "[email protected]")  '        ## PayPal e-mail Of second receiver                             
    NVP.Add("PAYMENTREQUEST_1_PAYMENTREQUESTID", "CART2")  '                     ## unique ID Of second payment – End primary level information For secondary payment                        
    NVP.Add("L_PAYMENTREQUEST_1_NAME0", "Orange crush")  '                       ## Start secondary level information For secondary payment first item             
    NVP.Add("L_PAYMENTREQUEST_1_NUMBER0", "MC - 77")  '                                     
    NVP.Add("L_PAYMENTREQUEST_1_QTY0", "1")  '                                     
    NVP.Add("L_PAYMENTREQUEST_1_AMT0", "65")  '                                     
    NVP.Add("L_PAYMENTREQUEST_1_TAXAMT0", "10")  '                               ## End secondary level information For second payment first item      



    ''build the parameter string
    Dim paramBuilder As New StringBuilder
    For Each kv As KeyValuePair(Of String, String) In NVP
        Dim st As String
        st = kv.Key & "=" & HttpUtility.UrlEncode(kv.Value) & "&"
        paramBuilder.Append(st)
    Next

    Dim param As String
    param = paramBuilder.ToString
    param = param.Substring(0, param.Length - 1) ''remove the last '&'


    ''Create web request and web response objects, make sure you using the correct server (sandbox/live)
    Dim wrWebRequest As Net.HttpWebRequest = DirectCast(Net.WebRequest.Create(paypalApiServerUrl), Net.HttpWebRequest)
    wrWebRequest.Method = "POST"


    Dim requestWriter As New IO.StreamWriter(wrWebRequest.GetRequestStream())
    requestWriter.Write(param)
    requestWriter.Close()

    '' Get the responseReader
    Dim responseReader As IO.StreamReader
    responseReader = New IO.StreamReader(wrWebRequest.GetResponse().GetResponseStream())

    ''read the response
    Dim responseData As String
    responseData = responseReader.ReadToEnd()
    responseReader.Close()


    ''url-decode the results
    Dim result As String
    result = HttpUtility.UrlDecode(responseData)

    Dim formattedResult As String

    formattedResult = "Request on " & paypalApiServerUrl & vbCrLf &
                     HttpUtility.UrlDecode(param.Replace("&", vbCrLf & "  ")) & vbCrLf & vbCrLf &
                     "Result:" & vbCrLf & HttpUtility.UrlDecode(responseData.Replace("&", vbCrLf & "  ")) & vbCrLf & vbCrLf &
                     "--------------------------------------" & vbCrLf

    ''show the results
    Console.WriteLine(formattedResult)
    Response.Write(formattedResult)
    MSG.Text = formattedResult



End Sub

What I came up with is not working,


Message: The request was aborted: Could not create SSL/TLS secure channel.


Found these resources which helped shed some light on the subject

http://brad.w3portals.com/2008/03/paypal-nvp-api-example-for-vbnet-aspnet.html

How to create Encrypted PayNow button "on the fly" for Third-party customers, using Paypal NVP API?

https://www.paypal.com/businessprofile/mytools/apiaccess/firstparty/signature

2

Answers


  1. For name value pair format, the values (right hand side) should be URL encoded, and the pairs should be separated by ampersands (&)

    You can have a function that builds the request string text out of an array or dictionary

    Login or Signup to reply.
  2. Are you using a valid USER/PWD/Signature from the profile of a Sandbox Business account at https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Faccounts%2F ?


    An SSL/TLS error may be due a lack of TLSv1.2 support on the server or framework environment, among other possible causes like not trusting the root CA issuer of the SSL certificate of the api-3t.paypal.com server it’s connecting to

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search