1
votes

I am using braintree SDK for payments. I have successfully integrated payment methods and transactions. But now I am stuck in updating the credit information if user decides to use their other card instead of the old one.

To achieve this I have made a web service which gets cardholder name, cc no, expiration month and year and cvv.

1
I'm a developer at Braintree. This question seems very specific to your integration, I recommend contacting support directly for help with it.BladeBarringer

1 Answers

1
votes

You can create the credit card by submitting all the details like this:

result = Braintree_CreditCard::create([
    'cardholder_name' => 'John Doe',
    'cvv' => '123',
    'expiration_date' => '12/2019,
    'number' => '4111111111111111',
    'options' => [
        'verify_card' => True
    ]
])
# use this credit card token(5mk3f2).
print(result.credit_card.token)

We this credit card token to update the credit card by as follows:

$result = Braintree_PaymentMethod::update(
  '5mk3f2',
  [
      'cardholder_name' => 'Doe Jhon',
      'cvv' => 'XXX',
      'expiration_date' => '8/2020,
      'number' => '4111111111111118',
      'billingAddress' => [
          'streetAddress' => '100 Maple Lane',
          'options' => [
            'updateExisting' => true
          ]
     ]
 ]);