【发布时间】:2017-12-27 00:43:19
【问题描述】:
我想知道如何使用存储的信用卡创建费用。
使用 /card api 我已成功将卡片存储在 QuickBooks Online 中并收到卡片 ID 作为回报。
现在我想对存储的卡进行收费。为了创建费用,我看到有两种方法可以提供卡详细信息。
- 提供明确的卡详细信息,例如卡号、到期日期等。
- 通过使用卡令牌。但即使是为了检索卡令牌,我们也需要向 /tokens api 调用提供明确的卡详细信息。
我尝试使用它的 ID 检索存储的卡,然后在 Charge 中使用退回的卡详细信息,但它不起作用。
所以我想知道如何通过使用存储的信用卡而不需要每次都提供明确的信用卡详细信息来创建费用。
更新
我尝试了以下测试代码,但它给了我“card.number is invalid”错误。
public Charge createCharge(Context context, String requestId) {
String uri = "https://sandbox.api.intuit.com/quickbooks/v4/payments/charges";
PaymentService paymentService = new PaymentService();
Charge charge = new Charge();
CreditCard card = null;
try {
card = paymentService.getCreditCard(context, getRequestId(), "https://sandbox.api.intuit.com/quickbooks/v4/customers/{customer_id}/cards/{card_id}");
} catch (Exception e) {
e.printStackTrace();
}
charge.setCard(card);
charge.setAmount(new BigDecimal(10.55));
charge.setCurrency("USD");
try {
charge = paymentService.createCharge(context, getRequestId(), charge, uri);
return charge;
} catch (Exception e) {
}
}
Error com.intuit.ipp.exception.BadRequestException: ERROR CODE:PMT-4000, ERROR MESSAGE:card.number is invalid., ERROR DETAIL:card.number, MORE ERROR DETAIL:HttpStatusCode=400; Type=invalid_request; MoreInfo=Credit/Debit card number format, InfoLink=https://developer.intuit.com/v2/docs?redirectID=PayErrors
我使用卡 ID 检索到的卡中的卡号(显然)被混淆了,格式为“xxxxxxxxxxxx1111”,因此 /charges api 抱怨它无效。
【问题讨论】:
标签: java quickbooks-online intuit