I need to build an api method which should receive customer's payment information (credit card info) along with product details and place an order with it further processing.
Right now I faced that braintree
payment facade requires credit card tokenization which is made via javascript during checkout process, as well as authorize.net method is connecting to transact.dll
endpoint.
Is this actually possible, to trigger order processing only in backend ?
Can I refer somewhere in existing magento2 code to see how it is made, maybe in some adminhtml area ?
The code i use to create an order:
// prepare adresses, products in quote, shipping method - skipped
$quote->setPaymentMethod('authorizenet_directpost');
$quote->setInventoryProcessed(false);
// Set Sales Order Payment
$quote->getPayment()->importData(
[
'method' => 'authorizenet_directpost',
'card_type' => $payment->cardType,
'cvv' => $payment->cvv,
'expire_year' => $payment->expireYear
]
);
$customer = $this->customerRepository->get($contact->email);
// prepare customer
$quote->setCustomer($customer);
// Collect Totals & Save Quote
$quote->collectTotals()->save();
$order = $this->quoteManagement->submit($quote);