Hi all,
So far, I'm registering orders by calling the following endpoint:
V1/carts/{cartId}/order
While, according to the documentation, the complete payload looks like...
{
"paymentMethod": {
"po_number": "string",
"method": "string",
"additional_data": [
"string"
],
"extension_attributes": {
"agreement_ids": [
"string"
]
}
}
}
...I'm only passing the paymentMethod[method] field, setting its value to checkmo, just for the sake of making a POC work.
Yet this works fine! I can actually see my orders in the Back-Office.
Now, I have to connect to a real Payment Gateway. BrainTree is natively supported by Magento, so I activated and configured it in sandbox mode, from the Back-Office.
Then I changed the payload described above to paymentMethod[method]=braintree, that's all. The V1/carts/{cartId}/order request returns the following message...
Transaction has been declined. Please try again later.
...and I noticed this line on the server's logs:
'message' => 'Cannot determine payment method.',
Obviously, the payload isn't complete enough, and I guess the additional_data field has to be filled. Unfortunately, after having googled a little bit, I didn't find the way to pass the payload BrainTree actually needs.
Appreciate any help.
Cheers,
Dave