PHP create payment methid fails on invalid keys: options[makeDefault]
camohub opened this issue · 1 comments
camohub commented
- SDK/Library version: php 6.4
- Environment: Windows 10 sandbox
I have a nonce from javascript dropin. Then I would like to create/update payment method and set it as default. So according documentation I send the makeDefualt option to the paymentMthod->create(). But it throws me an error:
Payment failed. Invalid keys: options[makeDefault]
$braintree_request = [
'customerId' => $braintree_id,
'paymentMethodNonce' => $payment_method_nonce,
'options' => [
'verifyCard' => true,
'makeDefault' => true,
]
];
$result = $this->braintree->paymentMethod()->create($braintree_request);
What is wrong with this code? I need it cause I hope the front end dropIn will be able to preselect the default card on load. Now the default is the first one stored in the vault.
Also I dont understand how to update payment method if I dont have token but the nonce. Did not find any documentation to that.
Thanks for help.
camohub commented
My fault. I used this in sale().