-
-
Save allsecure-pay/709273644c8807f9ce082d8804b4c67f to your computer and use it in GitHub Desktop.
SecurePay-VB (PA)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Imports System.IO | |
Imports System.Net | |
Imports System.Text | |
Partial Class _Default | |
Inherits System.Web.UI.Page | |
Public CheckoutId As String = "" | |
Protected Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender | |
CheckoutId = prepareCheckout() | |
End Sub | |
Public Function prepareCheckout() As String | |
Dim url As String = "https://test.oppwa.com/v1/checkouts" | |
Dim data As String = "authentication.userId=8a8294184f45ce7e014f4b1d16cc12df" + | |
"&authentication.password=j3zCJ2ENaD" + | |
"&authentication.entityId=8a8294184f45ce7e014f4b1d16bd12db" + | |
"&paymentType=PA" + | |
"&amount=499.99" + | |
"¤cy=RSD" | |
Dim request As WebRequest = WebRequest.Create(url) | |
request.Method = "POST" | |
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(data) | |
request.ContentType = "application/x-www-form-urlencoded" | |
request.ContentLength = byteArray.Length | |
Dim dataStream As Stream = request.GetRequestStream() | |
dataStream.Write(byteArray, 0, byteArray.Length) | |
dataStream.Close() | |
Dim webresponse As WebResponse = request.GetResponse() | |
dataStream = webresponse.GetResponseStream() | |
Dim reader As New StreamReader(dataStream) | |
Dim response As String = reader.ReadToEnd() | |
reader.Close() | |
dataStream.Close() | |
webresponse.Close() | |
Dim jss As New System.Web.Script.Serialization.JavaScriptSerializer() | |
Dim dict As Dictionary(Of String, Object) = jss.Deserialize(Of Dictionary(Of String, Object))(response) | |
Return dict("id") | |
End Function | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment