在 CyberSource 中,您如何使用信用卡灵活令牌进行支付 API?
In CyberSource, how do you use a credit card flexible token with payments API?
试图了解 CyberSource 的工作原理。
在 CyberSource 中,Secure Acceptance Flexible Token API 可用于在客户端对信用卡进行标记,以供将来处理。
这部分很简单。有很多文档和一些包可以做到这一点。
然后我如何使用该令牌通过 CyberSource Payments 创建费用 API?
我找到的所有示例都展示了如何在客户端对卡进行标记化,以及如何对未标记化的卡进行收费(即,将卡数据发送到服务器)但我找不到显示如何使用用于创建收费(或预授权)的灵活令牌。
在 Stripe 等大多数其他网关中,文档中的内容非常清楚,但 CyberSource 似乎没有提供。
我是不是漏掉了什么?
我正在使用 Node,但对其他语言的解决方案很满意。
https://developer.cybersource.com/api-reference-assets/index.html#flex
https://developer.visa.com/capabilities/cybersource/reference
好的,感谢@rhldr 指出此特定文档。
答案在 "Using the Token" 下的 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;
}
基于 CyberSource nodejs REST 示例的代码:https://github.com/CyberSource/cybersource-rest-samples-node
更多信息。一旦您知道在哪里查看,实际上会在几个地方进行解释。
例如,转到 https://developer.cybersource.com/cybs-dev-api-ref/index.html#payments-process-a-payment,展开下面的 "REQUEST FIELD DESCRIPTION" 并转到
customer
.. customerId
Unique identifier for the customer's card
and billing information.
When you use Payment Tokenization or Recurring Billing and you include
this value in your request, many of the fields that are normally
required for an authorization or credit become optional.
NOTE When you use Payment Tokenization or Recurring Billing, the value
for the Customer ID is actually the Cybersource payment token for a
customer. This token stores information such as the consumer’s card
number so it can be applied towards bill payments, recurring payments,
or one-time payments. By using this token in a payment API request,
the merchant doesn't need to pass in data such as the card number or
expiration date in the request itself.
See "Payment Tokenization," page 222, and "Recurring Billing," page
225.
试图了解 CyberSource 的工作原理。
在 CyberSource 中,Secure Acceptance Flexible Token API 可用于在客户端对信用卡进行标记,以供将来处理。
这部分很简单。有很多文档和一些包可以做到这一点。
然后我如何使用该令牌通过 CyberSource Payments 创建费用 API?
我找到的所有示例都展示了如何在客户端对卡进行标记化,以及如何对未标记化的卡进行收费(即,将卡数据发送到服务器)但我找不到显示如何使用用于创建收费(或预授权)的灵活令牌。
在 Stripe 等大多数其他网关中,文档中的内容非常清楚,但 CyberSource 似乎没有提供。
我是不是漏掉了什么?
我正在使用 Node,但对其他语言的解决方案很满意。
https://developer.cybersource.com/api-reference-assets/index.html#flex
https://developer.visa.com/capabilities/cybersource/reference
好的,感谢@rhldr 指出此特定文档。
答案在 "Using the Token" 下的 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;
}
基于 CyberSource nodejs REST 示例的代码:https://github.com/CyberSource/cybersource-rest-samples-node
更多信息。一旦您知道在哪里查看,实际上会在几个地方进行解释。
例如,转到 https://developer.cybersource.com/cybs-dev-api-ref/index.html#payments-process-a-payment,展开下面的 "REQUEST FIELD DESCRIPTION" 并转到
customer
.. customerId
Unique identifier for the customer's card and billing information.
When you use Payment Tokenization or Recurring Billing and you include this value in your request, many of the fields that are normally required for an authorization or credit become optional.
NOTE When you use Payment Tokenization or Recurring Billing, the value for the Customer ID is actually the Cybersource payment token for a customer. This token stores information such as the consumer’s card number so it can be applied towards bill payments, recurring payments, or one-time payments. By using this token in a payment API request, the merchant doesn't need to pass in data such as the card number or expiration date in the request itself.
See "Payment Tokenization," page 222, and "Recurring Billing," page 225.