Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm working on Adyen payment provider trying to submit a recurring payment request but i keep getting internal server error as response on this statement: requests.GetResponse() i don't know what i doing wrong in the code if someone can help me i tried their support they told me to check the support site site for articles i did and found nothing that helps my issue, below is the code i'm using.
VB
Public Function ChargeSubscriber(ByVal ShopperReference As String, ByVal shopperEmail As String, ByVal sid As String, ByVal UserName As String, ByVal amount As String, ByVal currency As String, ByVal Password As String, ByVal merchantaccount As String) As String
       Dim res As String = "1"
       If currency <> "JPY" Then
           amount = amount * 100
       End If
       Dim xml As String = "<?xml version=""1.0""?><soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><soap:Body><ns1:authorise xmlns:ns1=""http://payment.services.adyen.com""><ns1:paymentRequest><amount xmlns=""http://payment.services.adyen.com""><currency xmlns=""http://common.services.adyen.com"">" & currency & "</currency><value xmlns=""http://common.services.adyen.com"">" & amount & "</value></amount><ns1:merchantAccount>" & merchantaccount & "</ns1:merchantAccount><ns1:reference>RecurringPayment-0001</ns1:reference><ns1:shopperEmail>" & shopperEmail & "</ns1:shopperEmail><ns1:shopperReference>" & ShopperReference & "</ns1:shopperReference><ns1:selectedRecurringDetailReference>LATEST</ns1:selectedRecurringDetailReference><ns1:recurring><ns1:contract>RECURRING</ns1:contract></ns1:recurring><ns1:shopperInteraction>ContAuth</ns1:shopperInteraction></ns1:paymentRequest></ns1:authorise></soap:Body></soap:Envelope>"
       Dim requests As HttpWebRequest = WebRequest.Create("https://pal-test.adyen.com/pal/servlet/soap/Payment")
       requests.Credentials = New NetworkCredential(UserName, Password)
       requests.Method = "POST"
       requests.Headers.Add("SOAPAction", "http://tempuri.org/submitRecurring")
       Dim data() As Byte = Encoding.UTF8.GetBytes(xml)
       requests.ContentLength = data.Length
       requests.ContentType = " text/xml; charset=utf-8"
       Dim requestStream As Stream = requests.GetRequestStream()
       requestStream.Write(data, 0, data.Length)
       Dim webresp As HttpWebResponse = requests.GetResponse()
       Dim Answer As Stream = webresp.GetResponseStream()
       Dim AnswerS As StreamReader = New StreamReader(Answer)

       Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
       Dim rest As String = AnswerS.ReadToEnd()
       doc.LoadXml(rest)


       'resultCode()
       Return IIf(doc.GetElementsByTagName("resultCode")(0).InnerText = "Authorised", 1, -1)
   End Function
Posted
Updated 5-Dec-13 21:24pm
v2

Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.

Go back to their technical support and talk to them - they are paid to provide support (by you, when you get it working since they take a "cut" of all money going through) If they do not provide support, then find another payment service that will. But don;t ask for detailed help on "random" websites - the scope for fraud is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
 
Share this answer
 
Comments
petra.elhashem 6-Dec-13 3:38am    
Thank you but as u see i didn't post any parameter like username or password or anything that would put the payer in danger if u noticed all the parameters are left as parameters. It's true they should provide me support but sadly they didn't answer my question. And my question is technical more then commercial i was hoping that someone here worked before on adyen and maybe my mistake is in how a making the soap request, or the soap action I'm using anw thank you for your comment. It's not like im not gonna check the solution carefully before implementing it. And code project is not insecure website many questions here are about paypal, also there is another about Adyen and many other payment provider it's not a big deal to ask for a technical help from someone who has worked on payment provider before.
For anyone who's facing the same issue the solution turned out to be extremely simple.
Just save the wsdl file provided online anywhere on your pc then right click on the solution then choose add a service reference. Click advanced choose add web reference put the full path to the saved wsld. Then build ur website.
you will have all the functions you need as an example what i was attempting to do using httpwebrequest and soap can be done with these lines:
VB
If currency <> "JPY" Then
            amount = amount * 100
        End If
        Dim _Payment As AdyenPayment.Payment = New AdyenPayment.Payment()
        Dim _paymentRequest As AdyenPayment.PaymentRequest = New AdyenPayment.PaymentRequest()
        _paymentRequest.amount = New AdyenPayment.Amount()
        _paymentRequest.amount.currency = currency
        _paymentRequest.amount.value = amount
        _paymentRequest.merchantAccount = merchantaccount
        _paymentRequest.recurring = New AdyenPayment.Recurring()
        _paymentRequest.recurring.contract = "RECURRING"
        _paymentRequest.selectedRecurringDetailReference = "LATEST"
        _paymentRequest.shopperEmail = shopperEmail
        _paymentRequest.shopperReference = ShopperReference
        _paymentRequest.shopperInteraction = "ContAuth"
        _paymentRequest.reference = reference
        _Payment.Credentials = New NetworkCredential(UserName, Password)
        Dim _PaymentResult As AdyenPayment.PaymentResult = _Payment.authorise(_paymentRequest)
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900