Hassan Amir Khan
Hassan Amir Khan

Reputation: 635

How to re-verify credit card in vault before sale transaction in Braintree

How can I re-verify payment method [credit card] in vault before doing sale transaction.

Note: CVV and AVS rules are enable.

Scenario is:

Upvotes: 4

Views: 1873

Answers (1)

drs6222
drs6222

Reputation: 616

I believe it depends on how you are integrated with Braintree. Are you using their Hosted Fields? Drop-In?

Basically, according to their docs, you would create a nonce that contains only the CVV you prompted the user for.

braintree.setup('YOUR_CLIENT_TOKEN', 'custom', {
  id: 'my-sample-form',
  hostedFields: {
    cvv: {
      selector: '#cvv'
    }
  }
});

Once you have that nonce, you can pass it to a PaymentMethod.update() call for the appropriate payment method token, and ensure verify_card is set to true.

result = braintree.PaymentMethod.update("the_payment_method_token", {
    "payment_method_nonce": nonce_from_the_client,
    "options": {
        "verify_card": True,
    }
})

Found at https://developers.braintreepayments.com/reference/request/payment-method/update/#card-verification

Upvotes: 1

Related Questions