I'm trying to create an order programmatically using braintree payment method and the customer's saved credit card.

// prepare adresses, products in quote, shipping method - skipped
    // Set Sales Order Payment

    $quote->getPayment()->importData(array('method' => 'braintree, 'cc_type' => 'AE', 'cc_exp_month' => '05', 'cc_exp_year' => '2022', 'public_hash' => $public_hash));

    $customer = $this->customerRepository->get($contact->email);
   // prepare customer

    // Collect Totals & Save Quote
    $order = $this->quoteManagement->submit($quote);

I have access to all of the saved CC information from the customer, I'm just not sure what info needs to be passed in $quote->getPayment(importData(array(....));

In my payment.log file I see the following error when attempting to create orders using the saved CC:

Cannot determine payment method.

Any ideas how to process payments using Braintree vaulted cards?


I was able to figure this out, you just need to pass the payment_method_nonce and public_hash along with the payment method braintree_cc_vault:


$quote->getPayment()->importData(array('method' => 'braintree_cc_vault', 'public_hash' => $public_hash, 'payment_method_nonce' => $paymentMethodNonce));


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.