使用python进行Vantiv支付网关认证错误?

时间:2017-12-01 12:23:53

标签: python integration payment-gateway

我正在尝试使用python语言集成Vantiv payment gateway

但是,当我使用提供的测试凭据merchant id: 755847002password: xyz在网址https://w1.mercurycert.net/PaymentsAPI/Credit/Sale上请求时,它仍会显示错误消息:

Unauthorized: Access is denied due to invalid credentials.

我正在传递文档中提供的JSON数据:

card_data = {
    "InvoiceNo": "1",
    "RefNo": "1",
    "Memo": "MPS Example JSON v1.0",
    "Purchase": "1.00",
    "Frequency": "OneTime",
    "RecordNo": "RecordNumberRequested",
    "TerminalName": "MPS Terminal",
    "ShiftID": "MPS Shift",
    "OperatorID": "MPS Operator",
    "AcctNo": "4003000123456781",
    "ExpDate": "0517",
    "Address": "4 Corporate Square",
    "Zip": "30329",
    "CVVData": "880",
}
headers = {
    'Authorization': 'Basic [Wzc1NTg0NzAwMV06W3h5el0=]',
    'Content-Type': 'application/json',
}
payment = requests.post(
    'https://w1.mercurycert.net/PaymentsAPI/Credit/Sale',
    headers=headers,
    data=card_data)

当我查看响应变量payment时,它仍会显示错误消息。 任何人都可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

实际上,我只需要编码“授权”标头即可。

我在错误的地方使用了此API,我使用的API(RESP API)只能与可以对数据进行编码的扫描仪设备一起使用。相反,我需要使用Hosted Checkout API,它对我有用。