postman - MPGS(万事达卡): How to tokenize a transaction (how to create token)?

标签 postman integration payment

我正在尝试使用 MPGS 创建 token 。

我正在遵循本指南:

https:// sample-sub.domain .mastercard.com/api/documentation/integrationGuidelines/supportedFeatures/pickAdditionalFunctionality/tokenization/tokenization.html?locale=en_US#x_tokenConfiguration

在“ token 操作”>“ token 化”部分中,它说:

You can use this operation to create or update a token by storing payment details against the token. ...



我发布此信息是为了帮助像我一样对 MPGS 感到沮丧的人。我遇到了一系列问题,并多次脱掉头发。所以这是我面临的问题以及如何解决它们(我被问题 4 困住了)。

问题 #1: 凭据无效。

修复 :确保您点击了正确的 URL。

https:// 示例子域 .mastercard.com/..

https:// some.other-example .mastercard.com/..

https:// 百万其他可能性 .mastercard.com/..

甚至文档指南链接也有这些相同的子域,因此请确保您点击了正确的 URL,并确保您遵循正确的文档链接。

问题 #2: 参数无效,或服务器请求参数,尽管您已提供。

修复: 如果使用 Postman,请确保将“Body”>“ raw ”中的参数设置为 JSON,如下所示:
{
    "sourceOfFunds": {
        "provided": {
            "card": {
                "expiry": {
                    "month": "05",
                    "year": "21"
                },
                "number": "5123456789012346"
            }
        },
        "type": "CARD"
    }
}

问题 #3: 需要授权

修复:如果使用 postman ,点击“授权”,将“类型”它基本认证,对于“用户名”将其设置为 merchant.YOUR_MERCHANT_ID ,为“密码”将其设置为 YOUR_API_PASSWORD

问题 #4(卡在此处): 值“9999999999999999”无效。不得提供卡 token

方法: PUT

网址:https:// test-my.sample.gateway .mastercard.com/api/rest/version/46/merchant/ MY_MERCHANT_ID /token/9999

授权:在授权选项卡中正确设置

body > 原始:
{
    "sourceOfFunds": {
        "provided": {
            "card": {
                "expiry": {
                    "month": "05",
                    "year": "21"
                },
                "number": "5123456789012346"
            }
        },
        "type": "CARD"
    }
}

回复:
{
    "error": {
        "cause": "INVALID_REQUEST",
        "explanation": "Value '9999999999999999' is invalid. Card token must not be supplied",
        "field": "tokenid",
        "validationType": "INVALID"
    },
    "result": "ERROR"
}

Q: 不知道如何标记交易..?!我被 问题 #4 困住了。

最佳答案

好吧,终于想通了。 MPGS 有两种创建/更新 token 的方法:

  • Tokenization where YOU provide the token(注意: PUT 方法)
  • Tokenization where MPGS generate the token for you(注意: POST 方法)

  • 他们非常相似。

    我让它与第二个选项一起工作。

    注意:这是 POST 方法!!

    方法: POST

    网址:https:// SUBDOMAIN_YOU_SHOULD_BE_USING .mastercard.com/api/rest/version/50/merchant/ YOUR_MERCHANT_ID _0x104567

    在 postman 中,设置授权(如问题中所述,在 issue #3 中)。

    要发送的示例数据(在 postman 中,这应该在 Body > raw 中):
    {
        "sourceOfFunds": {
            "provided": {
                "card": {
                    "expiry": {
                        "month": "05",
                        "year": "21"
                    },
                    "number": "5123456789012346"
                }
            },
            "type": "CARD"
        }
    }
    

    示例响应:
    {
        "repositoryId": "1000000000002",
        "response": {
            "gatewayCode": "BASIC_VERIFICATION_SUCCESSFUL"
        },
        "result": "SUCCESS",
        "sourceOfFunds": {
            "provided": {
                "card": {
                    "brand": "MASTERCARD",
                    "expiry": "0521",
                    "fundingMethod": "CREDIT",
                    "issuer": "BANCO DEL PICHINCHA, C.A.",
                    "number": "512345xxxxxx2346",
                    "scheme": "MASTERCARD"
                }
            },
            "type": "CARD"
        },
        "status": "VALID",
        "token": "9717501974559694",
        "usage": {
            "lastUpdated": "2019-02-25T09:36:54.928Z",
            "lastUpdatedBy": "1015",
            "lastUsed": "2019-02-25T09:36:54.928Z"
        },
        "verificationStrategy": "BASIC"
    }
    

    关于postman - MPGS(万事达卡): How to tokenize a transaction (how to create token)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54324075/

    相关文章:

    java - 如何通过 post man post 请求在 header 中传递对象?

    asp.net-mvc-3 - MVC3-可以添加到现有应用程序的轻量级CMS?

    hadoop - 是否可以集成Kdb +和hadoop?

    django - AttributeError at/api/updateorder/71 'RelatedManager' 对象没有属性 'save'

    javascript - Postman Get call 500 内部服务器错误

    android - 从 Android Market 接收付款

    大约 2012 年的 Android 支付平台选项

    android - 如何读写移动设备上的安全元件以实现 NFC 支付目的?

    validation - 在 Postman 测试中使用哪个片段来验证 header 值的一部分

    Spring-Drools 集成 : Referenced file (kie-spring. xsd) 包含错误