android - 如何创建/更新 session ? (万事达卡网关集成在安卓和 iOS 中)

标签 android ios postman integration mastercard

我正在尝试使用卡信息更新 session 。

我正在遵循本指南:

https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Update%20Session.html?locale=en_US

在“更新 session ”部分,它说:

You can request to add or update request fields contained in the session.


使用 Postman,我设置了

授权:基本身份验证在用户名部分为“商家。{您的网关商家 ID}”,在密码部分为您的 API 密码。

网址:“ https://ap-gateway.mastercard.com/api/rest/version/51/merchant/ {merchantId}/session/{sessionId}

方法:PUT

正文:“raw”作为 JSON,如下所示:

{
    "sourceOfFunds":{
        "provided":{
            "card":{
                "nameOnCard":"Joseph",
                "number":"5506900140100305",
                "securityCode":"100",
                "expiry":{
                    "month": "05",
                    "year": "21"
                }
            }
        }
    }
}

问题:获取响应。

{
    "error": {
        "cause": "INVALID_REQUEST",
        "explanation": "Directly providing cardholder data is not supported. Consider using a session or token."
    },
    "result": "ERROR"
}

我是如何获得Session id的。

我遵循了这个指南:

https://ap-gateway.mastercard.com/api/documentation/apiDocumentation/rest-json/version/51/operation/Session%3a%20Create%20Session.html?locale=en_US


使用 Postman,我设置了

授权:基本身份验证在用户名部分为“商家。{您的网关商家 ID}”,在密码部分为您的 API 密码。

网址:“ https://ap-gateway.mastercard.com/api/rest/version/51/merchant/ {merchantId}/session

方法:POST

正文:“raw”作为 JSON,如下所示:

{
   "apiOperation": "CREATE_CHECKOUT_SESSION",
   "order": {
       "currency": "USD",
       "id": "2000",
       "amount": 5
   }
}

成功:获得响应。

{
    "merchant": "merchantId",
    "result": "SUCCESS",
    "session": {
        "id": "SESSION0002210064458I18884862F9",
        "updateStatus": "SUCCESS",
        "version": "f531053101"
    },
    "successIndicator": "4c47702b70cb4f16"
}

我在上述请求中收到的 session ID 已传递给更新 session 请求。

我希望更新的 session 包含卡信息,但出现错误: “不支持直接提供持卡人数据。考虑使用 session 或 token 。”

最佳答案

出现此错误是因为您尚未为您的 merchantID 启用 token 化。

您可以使用以下步骤集成支付网关: 1. 使用以下主体进行 CREATE CHECKOUT SESSION API 调用

    {
    "apiOperation" : "CREATE_CHECKOUT_SESSION",
    "order": {
            "amount" : "0.001",
            "currency" : "BHD",
            "id" : "3"
        },
        "interaction":{
        "operation":"PURCHASE", 
        "returnUrl":"http://www.your-success-page-url.com/",
        "cancelUrl":"http://pay.your-failure-page-url.com/"
        }
    }

第 3 步:复制 sessionID 并将其附加到支付网关 URL 的末尾,然后将此 URL 粘贴到浏览器中。 示例:https://gateway.mastercard.com/checkout/pay/SESSION_ID_OF_CHECKOUT_SESSION_API

关于android - 如何创建/更新 session ? (万事达卡网关集成在安卓和 iOS 中),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57197028/

相关文章:

android - 无法在 Android Studio 中删除目录

Android Studio 构建失败

java - 折叠工具栏不会随着抽屉布局而折叠

ios - UIDocument 不起作用

ios - Feedly 标记为已读不适用于 Objective-C

android - 如何用空字符串消除 textview 的边距?

iphone - Default-568h@2x.png 正在缩放

asp.net-web-api2 - 使用值 (FromBody) 发布时,Web Api 字符串参数 (fromQuery) 始终为 null

http - 如何在 POSTMAN 中的 2 个请求之间添加暂停

java - Postman对Spring Controller的Post调用始终为null