Login | Register
Download  |  About tellaW  |  Web API  |  Press
 

Web API

Introduction

Each client will be given a unique payment URL to submit payment form and a unique Client Key for hash generation.  This hash will be used to verify that the postback result is from the correct server and the data has not been tampered.

To start a payment

Post form to URL you are assigned

Field Name

Type

Value

Note

clientID

String

Pre-assigned, Example: UKPEKING

orderID

String

 

Unique order ID for your own reference

amount

Decimal

 

Example: 12.69

Note

String

 

Order item name

email

String

 

Client email address

postbackURL

String

 

URL where the client will redirect after payment

 

Payment Result

After payment the client will be redirected to postbackURL, it is the website’s duty to parse the payment result from the parameters passed over.

VB.Net Example:

Public Sub ParseResponse()

     Dim clientkey As String = "6A80A68B96161D380F1E55C692D191ACDB6EBE75D7307BA236CF492B4CD7427A"

     Dim orderID As String = "UKPEKING_" + Request("orderid")

     Dim clientSig As String = CalculateHMAC(clientkey, EscapeVal(orderID) + ":" + EscapeVal(Request("amount")) + EscapeVal(Request("result")) + ":" + EscapeVal(Request("ct"))).Replace("+", " ")

 

     Dim paysuccess As Boolean = False

     If Request("sig") = clientSig Then

           paysuccess = (Request("result") = "Y")  ‘Payment successful if  Request("result") = “Y”

           amount = Request("amount") ‘Actual amount paid, e.g. 12.69

     End If

End Sub        

 

Public Shared Function EscapeVal(val As String) As String

     If val Is Nothing OrElse val = "" Then Return ""

     val = val.Replace("\", "\\")

     val = val.Replace(":", "\:")

     Return val

End Function

 

Public Shared Function PackH(hex As String) As Byte()

     If (hex.Length Mod 2) = 1 Then hex += "0"

     Dim bytes As Byte()

     ReDim bytes(hex.Length / 2)

     Dim i As Integer

     For i = 0 To hex.Length - 1 Step 2

           bytes(i / 2) = Convert.ToByte(hex.Substring(i, 2), 16)

     Next

     Return bytes

End Function

 

Public Shared Function CalculateHMAC(hmacKey As String, signingstring As String) As String

     Dim key As Byte() = PackH(hmacKey)

     Dim data As Byte() = Encoding.UTF8.GetBytes(signingstring)

     Using hmac = New HMACSHA256(key)

           Dim result As Byte() = hmac.ComputeHash(data)

           Return Convert.ToBase64String(result)

     End Using

End Function

 
Home  • About tellaW  • Press  • Promotion  • Partnership  • Join Wallet FREE
Contact us  • Terms and Conditions  • Privacy Policy  •  • 
©opyright Youngs Investment Co.Ltd. 2005-2014. All rights reserved