Skip to content

Instantly share code, notes, and snippets.

@allsecure-pay
Created December 19, 2018 10:38
Show Gist options
  • Save allsecure-pay/4b561726d6894397b2536f034311fea9 to your computer and use it in GitHub Desktop.
Save allsecure-pay/4b561726d6894397b2536f034311fea9 to your computer and use it in GitHub Desktop.
SecurePay-VB (Status)
Imports System.Net
Imports System.IO
Partial Class Status
Inherits System.Web.UI.Page
Public Result As String = ""
Protected Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
getPaymentStatus(Request.Form("id"))
End Sub
Private Sub getPaymentStatus(checkoutId As String)
Dim url As String = "https://test.oppwa.com/v1/checkouts/" + checkoutId + "/payment"
Dim request As WebRequest = WebRequest.Create(url)
Dim webresponse As WebResponse = request.GetResponse()
Dim dataStream As Stream = 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)
If dict("result")("code").StartsWith("000") Then
Result = "SUCCESS <br/><br/> Here is the result of your transaction: <br/><br/>"
Result += response
Else
Result = "ERROR <br/><br/> Here is the result of your transaction: <br/><br/>"
Result += response
End If
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment