Plugin Support
dougaitken
(@dougaitken)
Automattic Happiness Engineer
Hey there,
> Is possible to put this together in the rest endpoint to create a payment?
That wouldn’t be something can offer support for I’m afraid.
The Braintree extension is used to take payments at the checkout for an order created by the customer.
Thanks for the quick response,
I did manage to create a successful payment using the process_payment and the nonce provided by the drop-in? is this a bad idea? I am worried for unforeseen use cases 🙁
$_POST['payment_method'] = $args['payment_method'];
$_POST['wc_braintree_credit_card_payment_nonce'] = $args['payment_payload']['nonce'];
$result = $available_gateways[ $rbody['payment_method'] ]->process_payment($order_id);
if (isset($result['result']) && 'success' === $result['result']) {
$result = apply_filters('woocommerce_payment_successful_result', $result, $order_id);
$order->update_status('completed');
}
Plugin Support
dougaitken
(@dougaitken)
Automattic Happiness Engineer
Hey again,
> is this a bad idea? I am worried for unforeseen use cases
Honestly, I couldn’t advise, this isn’t the use-case for the payment extension so it isn’t something we support and could give advice around.
For advice around this, I would recommend reaching out to one of our vetted developers on our WooExperts page, join the WooCommerce Slack Community, or the Advanced WooCommerce Facebook group
Plugin Support
dougaitken
(@dougaitken)
Automattic Happiness Engineer
We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.