与POS交互 - 终端设备和银行交换系统

问题描述 投票:6回答:1

我有一个项目,我需要与POS交互 - 终端设备和磁/芯片卡。假设客户从我的百货商店购买商品时,该商店的员工将对客户的金融卡进行分类并进行支付交易。

对于那些类似的系统,大多数论坛都说应该考虑使用第三方API,例如:

  • 贝宝
  • 布伦特里
  • authorize.net.
  • Google Check-Out API。

但我认为这些API应该用于那些将用于国际支付处理的系统。至于我,我认为我的系统没有国际支付处理那么大,并且将开始作为国内小型系统工作。

那么我想知道哪个是最佳解决方案以及系统架构将如何?

当我读到Authorize.Net页面时,我找到了信用卡处理的例行程序。

  • 无论我的项目是大型还是小型,国际运行还是国内运行,我都需要遵循这整个程序吗?
  • 我是否真的需要按照此程序使用POS - 终端设备进行支付流程?

我知道的一件事是ISO 8583是必不可少的金融消息传递协议,因为我所在地区的大多数银行转换软件系统只使用这些消息传递格式。这意味着我不能使用其他消息格式,例如我们的NDC或D912。

credit-card payment-processing iso8583 jpos
1个回答
5
投票

Authorize.net非常易于使用。处理卡片所需要做的就是以XML格式发送https帖子。 Authorize.net开发人员站点上有几个示例。对于刷卡,大多数读卡器模拟键盘按键。刷卡看起来与此类似:

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

然后解析卡号“5500692805076849”,名称“SMITH / STEPHEN A”和到期日期“1204”并传递给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
© www.soinside.com 2019 - 2024. All rights reserved.