Я пытаюсь отправить платеж с помощью кредитной карты с помощью QuickBooks Online SDK, но когда я запускаю свой код, я получаю следующую ошибку:
Номер необработанной кредитной карты не поддерживается. Номер кредитной карты Tokenized
Обязательно
Вот что у меня есть. Может кто-нибудь объяснить, как я могу токенизировать номер карты с помощью SDK, прежде чем использовать его таким образом?
public Payment PaymentCreditCard(Order order, ServiceContext qboContextoAuth)
{
Payment payment = new Payment();
payment.TxnDate = Convert.ToDateTime(order.DateCreated);
payment.TxnDateSpecified = true;
Account depositAccount = Helper.FindOrAddAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset);
payment.DepositToAccountRef = new ReferenceType()
{
name = depositAccount.Name,
Value = depositAccount.Id
};
PaymentMethod paymentMethod = Helper.FindOrAdd<PaymentMethod>(qboContextoAuth, new PaymentMethod());
payment.PaymentMethodRef = new ReferenceType()
{
name = paymentMethod.Name,
Value = paymentMethod.Id
};
Customer customer = Helper.FindOrAdd<Customer>(qboContextoAuth, new Customer());
payment.CustomerRef = new ReferenceType()
{
name = customer.DisplayName,
Value = customer.Id
};
payment.PaymentType = PaymentTypeEnum.CreditCard;
CreditCardPayment creditCardPayment = new CreditCardPayment();
CreditChargeInfo creditChargeInfo = new CreditChargeInfo();
creditChargeInfo.BillAddrStreet = order.BillingAddress;
creditChargeInfo.CcExpiryMonth = Convert.ToInt32(order.CCExpMonth);
creditChargeInfo.CcExpiryMonthSpecified = true;
creditChargeInfo.CcExpiryYear = Convert.ToInt32(order.CCExpYear);
creditChargeInfo.CcExpiryYearSpecified = true;
creditChargeInfo.CCTxnMode = CCTxnModeEnum.CardNotPresent;
creditChargeInfo.CCTxnModeSpecified = true;
creditChargeInfo.CCTxnType = CCTxnTypeEnum.Charge;
creditChargeInfo.CCTxnTypeSpecified = true;
//reditChargeInfo.CommercialCardCode = "Cardcode" + Helper.GetGuid().Substring(0, 5);
creditChargeInfo.NameOnAcct = order.BillingName;
creditChargeInfo.Number = order.CCNum;
creditChargeInfo.PostalCode = order.BillingZip;
creditCardPayment.CreditChargeInfo = creditChargeInfo;
payment.AnyIntuitObject = creditCardPayment;
payment.TotalAmt = Convert.ToDecimal(order.TotalAmount);
payment.TotalAmtSpecified = true;
payment.UnappliedAmt = Convert.ToDecimal(order.TotalAmount);
payment.UnappliedAmtSpecified = true;
//Adding the Payment
Payment added = Helper.Add<Payment>(qboContextoAuth, payment);
return added;
}
Из того, что я взял из необработанного API, вот что мне нужно:
https://developer.intuit.com/app/developer/qbpayments/docs/api/resources/all-entities/tokens
Но мне кажется, что я не могу найти такую функциональность в SDK. У кого-нибудь есть опыт в этом деле?