php - 使用 Cybersource SOAP API 时如何获取付款令牌
问题描述
因此,我使用如下所示的 Cybersource SOAP API 进行了测试付款,但我无法让它返回一个付款令牌,以便将来无需每次都使用信用卡详细信息即可用于付款:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{{merchant_id}}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{SOAP KEY}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.150">
<merchantID>{{merchant_id}}</merchantID>
<merchantReferenceCode>kjdhflasjfhlasdjfasdf</merchantReferenceCode>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<street1>1295 Charleston Road</street1>
<city>Mountain View</city>
<state>CA</state>
<postalCode>94043</postalCode>
<country>US</country>
<email>null@cybersource.com</email>
</billTo>
<item id="0">
<unitPrice>5.00</unitPrice>
<quantity>1</quantity>
</item>
<item id="1">
<unitPrice>10.00</unitPrice>
<quantity>2</quantity>
</item>
<purchaseTotals>
<currency>ZMW</currency>
</purchaseTotals>
<card>
<accountNumber>4111111111111111</accountNumber>
<expirationMonth>11</expirationMonth>
<expirationYear>2020</expirationYear>
<cvNumber>123</cvNumber>
</card>
<ccAuthService run="true"/>
</requestMessage>
</soapenv:Body>
</soapenv:Envelope>
解决方案
将以下内容添加到您的请求中:
<recurringSubscriptionInfo>
<frequency>on-demand</frequency>
</recurringSubscriptionInfo>
<paySubscriptionCreateService run="true"/>
您的新请求将如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>{{merchantID}}</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">{{SOAPKey}}</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
<soapenv:Body>
<requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.150">
<merchantID>{{merchantID}}</merchantID>
<merchantReferenceCode>kjdhflasjfhlasdjfasdf</merchantReferenceCode>
<billTo>
<firstName>John</firstName>
<lastName>Doe</lastName>
<street1>1295 Charleston Road</street1>
<city>Mountain View</city>
<state>CA</state>
<postalCode>94043</postalCode>
<country>US</country>
<email>null@cybersource.com</email>
</billTo>
<item id="0">
<unitPrice>5.00</unitPrice>
<quantity>1</quantity>
</item>
<item id="1">
<unitPrice>10.00</unitPrice>
<quantity>2</quantity>
</item>
<purchaseTotals>
<currency>ZMW</currency>
</purchaseTotals>
<card>
<accountNumber>4111111111111111</accountNumber>
<expirationMonth>11</expirationMonth>
<expirationYear>2020</expirationYear>
<cvNumber>123</cvNumber>
</card>
<recurringSubscriptionInfo>
<frequency>on-demand</frequency>
</recurringSubscriptionInfo>
<ccAuthService run="true"/>
<paySubscriptionCreateService run="true"/>
</requestMessage>
</soapenv:Body>
</soapenv:Envelope>
现在,响应中将包含一个订阅 ID,这是您用来代替卡帐号的令牌。您可能会发现标记化指南很有用。
您不应在此处公开您的商家 ID 和 SOAP 密钥。请编辑您的问题以删除它们。
推荐阅读
- java - 如何在spring webflux的同一函数中更新多个mongo集合?
- c# - 由于控制器中没有异步导致 500 服务器错误?需要帮助从列表中删除对象 C#
- javascript - 如何将值从控制器传递到 JavaScript 图表
- matlab - Octave 中的 validateattributes 函数存在问题
- r - 如何刻面图,每个图都包含一个插图?
- javascript - 如何获取从承诺返回的值并在其他文件中使用它?
- matrix - R中的存储问题。替代用于创建矩阵数组和多个绘图的嵌套循环
- python - 通过python运行简单查询:没有结果
- javascript - 在构建 GraphQL 查询和突变时使用这两种方法有什么区别?
- scala - foreach 函数奇怪的行为