2011-11-22 38 views
6

Tôi có một dự án mà tôi cần tương tác với POS - Thiết bị đầu cuối và thẻ từ/chip. Giả sử, bất cứ khi nào khách hàng mua hàng từ cửa hàng bách hóa của tôi, nhân viên từ cửa hàng này sẽ lấy thẻ tài chính của khách hàng và thực hiện giao dịch thanh toán.Tương tác với POS - Thiết bị đầu cuối và hệ thống chuyển mạch ngân hàng

Đối với những hệ thống tương tự, hầu hết các diễn đàn nói rằng nó cần được xem xét để sử dụng API của bên thứ ba như:

  • PayPal
  • Braintree
  • Authorize.NET.
  • API trả phòng của Google.

Nhưng tôi nghĩ rằng các API đó nên sử dụng cho các loại hệ thống sẽ được xử lý thanh toán quốc tế. Đối với tôi, tôi cho rằng hệ thống của tôi không lớn như xử lý thanh toán quốc tế và sẽ bắt đầu hoạt động như một hệ thống nhỏ trong nước.

Vì vậy, điều tôi muốn biết là giải pháp nào là tốt nhất và kiến ​​trúc hệ thống sẽ như thế nào?

Khi tôi đọc trang Authorize.Net, tôi đã tìm thấy thói quen của Xử lý thẻ tín dụng.

  • Tôi có cần phải làm theo toàn bộ quy trình này cho dù dự án của tôi lớn hay nhỏ, chạy quốc tế hay chạy trong nước?

  • Tôi có thực sự cần thực hiện theo quy trình này để thực hiện quy trình thanh toán với Thiết bị đầu cuối POS không?

Một điều tôi biết là ISO 8583 là giao thức tin nhắn tài chính cần thiết bởi vì hầu hết các chuyển đổi ngân hàng hệ thống phần mềm, cho khu vực của tôi, chỉ sử dụng những định dạng tin nhắn. Điều này có nghĩa là tôi không thể sử dụng định dạng nhắn tin khác như NDC hoặc D912.

Trả lời

5

Authorize.net rất dễ sử dụng. Tất cả những gì bạn cần làm để xử lý thẻ là gửi một bài đăng https ở định dạng XML. Có một số ví dụ trên trang web của nhà phát triển Authorize.net. Theo như thẻ swiping, hầu hết các đầu đọc thẻ mô phỏng các lần nhấn bàn phím. Một thẻ quẹt trông tương tự như sau:

'%B5500692805076849^SMITH/STEPHEN A^12041010000000  00969000000?;5500692805076849=12041010000000969?` 

Sau đó phân tích các số thẻ "5500692805076849", Name "SMITH/STEPHEN A" và ngày hết hạn "1204" và vượt qua những người trên Authorize.net

Private Sub cmdCharge_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCharge.Click 
    ' By default, this sample code is designed to post to our test server for 
    ' developer accounts: https://test.authorize.net/gateway/transact.dll 
    ' for real accounts (even in test mode), please make sure that you are 
    ' posting to: https://secure.authorize.net/gateway/transact.dll 
    cmdCharge.Enabled = False 
    lblResponse.Text = "Processing....." 
    Application.DoEvents() 
    Dim post_url 
    post_url = "https://test.authorize.net/gateway/transact.dll" 

    Dim post_values As New Dictionary(Of String, String) 

    'the API Login ID and Transaction Key must be replaced with valid values 
    post_values.Add("x_login", "XXXXXXX") 
    post_values.Add("x_tran_key", "XXXXXXXXX") 
    'post_values.Add("x_test_request", "TRUE") 
    post_values.Add("x_delim_data", "TRUE") 
    post_values.Add("x_delim_char", "|") 
    post_values.Add("x_relay_response", "FALSE") 

    post_values.Add("x_type", "AUTH_CAPTURE") 
    post_values.Add("x_method", "CC") 
    post_values.Add("x_card_num", txtCard.Text) 
    post_values.Add("x_exp_date", txtExp.Text) 

    post_values.Add("x_amount", txtAmount.Text) 
    'post_values.Add("x_description", "Sample Transaction") 

    post_values.Add("x_first_name", txtFirst.Text) 
    post_values.Add("x_last_name", txtLast.Text) 
    'post_values.Add("x_address", "1234 Street") 
    'post_values.Add("x_state", "WA") 
    post_values.Add("x_zip", txtZip.Text) 
    post_values.Add("x_card_code", txt3CV.Text) 

    ' Additional fields can be added here as outlined in the AIM integration 
    ' guide at: http://developer.authorize.net 

    ' This section takes the input fields and converts them to the proper format 
    ' for an http post. For example: "x_login=username&x_tran_key=a1B2c3D4" 
    Dim post_string As String = "" 
    For Each field As KeyValuePair(Of String, String) In post_values 
     post_string &= field.Key & "=" & field.Value & "&" 
    Next 
    ' post_string = Left(post_string, Len(post_string) - 1) 
    post_string = post_string.Substring(0, Len(post_string) - 1) 

    ' create an HttpWebRequest object to communicate with Authorize.net 
    Dim objRequest As HttpWebRequest = CType(WebRequest.Create(post_url), HttpWebRequest) 
    objRequest.Method = "POST" 
    objRequest.ContentLength = post_string.Length 
    objRequest.ContentType = "application/x-www-form-urlencoded" 

    ' post data is sent as a stream 
    Dim myWriter As StreamWriter = Nothing 
    myWriter = New StreamWriter(objRequest.GetRequestStream()) 
    myWriter.Write(post_string) 
    myWriter.Close() 

    ' returned values are returned as a stream, then read into a string 
    Dim objResponse As HttpWebResponse = CType(objRequest.GetResponse(), HttpWebResponse) 
    Dim responseStream As New StreamReader(objResponse.GetResponseStream()) 
    Dim post_response As String = responseStream.ReadToEnd() 
    responseStream.Close() 

    ' the response string is broken into an array 
    Dim response_array As Array = Split(post_response, post_values("x_delim_char"), -1) 

    ' the results are output to the screen in the form of an html numbered list. 
    Select Case response_array(0) 

     Case "1" 'Approved 
      lblResponse.Text = "Transaction Approved. " & vbCrLf & response_array(4) 

     Case "2" 'Declined 
      lblResponse.Text = "Transaction Declined. " & vbCrLf & response_array(3) 

     Case "3" 'Error 
      lblResponse.Text = "Transaction Error. " & vbCrLf & response_array(3) 

     Case "4" 'Held for Review 
      lblResponse.Text = "Transaction Held. " & vbCrLf & response_array(3) 

    End Select 

    ' individual elements of the array could be accessed to read certain response 
    ' fields. For example, response_array(0) would return the Response Code, 
    ' response_array(2) would return the Response Reason Code. 
    ' for a list of response fields, please review the AIM Implementation Guide 

    cmdCharge.Enabled = True 
End Sub 
Các vấn đề liên quan