【问题标题】:In CyberSource, how do you use a credit card flexible token with payments API?在 Cyber​​Source 中,您如何将信用卡灵活令牌与支付 API 结合使用?
【发布时间】:2019-10-16 04:37:08
【问题描述】:

试图了解 Cyber​​Source 的工作原理..

在 Cyber​​Source 中,Secure Acceptance 灵活令牌 API 可用于在客户端对信用卡进行令牌化处理,以供将来处理。

这部分很简单。有很多文档和一些包可以做到这一点。

然后如何使用该令牌通过 Cyber​​Source Payments API 创建收费?

我发现的所有示例都显示了如何在客户端对卡进行标记,以及如何对未标记的卡进行收费(即卡数据发送到服务器),但我找不到显示如何使用灵活令牌的示例创建费用(或预授权)。

在大多数其他网关(如 Stripe)中,文档中非常清楚,但 Cyber​​Source 似乎没有提供。

我错过了什么吗?

我正在使用 Node,但对其他语言的解决方案很满意。

https://developer.cybersource.com/api-reference-assets/index.html#flex

https://developer.visa.com/capabilities/cybersource/reference

【问题讨论】:

  • 您查看过 Flex 开发人员指南吗? developer.cybersource.com/api/developer-guides/dita-flex/…
  • @rhldr 哦,哇.. 我已经检查了所有文档,并正在寻找参考来指出它如何从不解释如何专门与 API 一起使用它,它实际上在这个..
  • @rhldr 链接到的文档似乎没有任何关于使用使用 Flex 创建的令牌的数据。
  • @MattMc 确实如此,它有点被埋没了。请参阅下面的答案..
  • @Ben 啊!我现在看到了,谢谢。不是在他链接的页面上,而是在你链接的那个页面上。

标签: cybersource


【解决方案1】:

好的,感谢 @rhldr 指出此特定文档。

答案在此页面https://developer.cybersource.com/api/developer-guides/dita-flex/SAFlexibleToken/FlexMicroform/GetStarted.html“使用令牌”下。

注意:其他一些文档(不知道为什么它们有许多不同的文档),例如 this one,根本没有提到这一点。

请参阅 RESTPaymentAPI 部分。它需要作为 customerId 字段提供。

"paymentInformation": {
    "customer": {
        "customerId": "7500BB199B4270EFE05340588D0AFCAD"
    }
}

这是一个如何在 API 端实现它的最小示例

var cybersourceRestApi = require('cybersource-rest-client');
var configuration = require('./cybersource/config.js');

var configObject = new configuration();
var instance = new cybersourceRestApi.PaymentsApi(configObject);

var clientReferenceInformation = new cybersourceRestApi.Ptsv2paymentsClientReferenceInformation();
clientReferenceInformation.code = 'test_payment';

var processingInformation = new cybersourceRestApi.Ptsv2paymentsProcessingInformation();
processingInformation.commerceIndicator = 'internet';

var amountDetails = new cybersourceRestApi.Ptsv2paymentsOrderInformationAmountDetails();
amountDetails.totalAmount = "100.00";
amountDetails.currency = 'USD';

var orderInformation = new cybersourceRestApi.Ptsv2paymentsOrderInformation();
orderInformation.amountDetails = amountDetails;


var paymentInformation = new cybersourceRestApi.Ptsv2paymentsPaymentInformation();

// THIS IS THE IMPORTANT BIT
var customer = new cybersourceRestApi.Ptsv2paymentsPaymentInformationCustomer()
customer.customerId = token
paymentInformation.customer = customer

var request = new cybersourceRestApi.CreatePaymentRequest();
request.clientReferenceInformation = clientReferenceInformation;
request.processingInformation = processingInformation;
request.orderInformation = orderInformation;
request.paymentInformation = paymentInformation;

if (!authoriseOnly) {
    request.processingInformation.capture = true;
}

基于 Cyber​​Source nodejs REST 示例的代码:https://github.com/CyberSource/cybersource-rest-samples-node


更多信息。一旦你知道在哪里看,它实际上在几个地方得到了解释。

例如,转到https://developer.cybersource.com/cybs-dev-api-ref/index.html#payments-process-a-payment,展开下面的“请求字段描述”并转到

customer         
    .. customerId    

客户卡的唯一标识符 和帐单信息。

当您使用支付标记化或定期计费时,您包括 您请求中的这个值,许多通常是 授权或信用所需的成为可选的。

注意当您使用支付标记化或定期计费时,值 客户 ID 实际上是 Cyber​​source 支付令牌 顾客。该令牌存储消费者卡等信息 号码,因此它可以应用于账单支付、经常性支付、 或一次性付款。通过在支付 API 请求中使用此令牌, 商户无需传入卡号等数据或 请求本身的到期日期。

请参阅“支付标记化”第 222 页和“定期计费”页面 225.

【讨论】:

  • 我面临同样的问题。我在 Cyber​​ Source iOS SDK 中生成了令牌,令牌是 base 64 编码字符串(很长)。正如你所说,我们需要在客户 ID 中提及令牌,我尝试了同样的方法,但它显示无效数据。我可以看到您的令牌很小并且不是 base64 编码的,但我的是。那么你能指导我你是怎么得到这个小支付令牌的吗?
  • @Deeps 在前端我使用他们的 Flex SDK 在客户端生成密钥。我在网络平台上,而不是iOS。我不确定等价物是什么。卡的标记化应该从客户端发生,而不是您的后端。
猜你喜欢
  • 1970-01-01
  • 2020-07-07
  • 1970-01-01
  • 1970-01-01
  • 2011-12-28
  • 2016-05-13
  • 2019-07-29
  • 2018-10-21
  • 2012-02-04
相关资源
最近更新 更多