Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is a payment nonce required for every transaction with Braintrree?

I'm developing a marketplace-like application that has support for payment processing through Braintree. However, most of my transactions will be quite small, and given the rate that Braintree charges, it's not feasible for me to process the transaction every time a user makes a purchase.

Therefore, I want to aggregate the payments on the backend, and charge users once they reach $X in accumulated expenditures, or once Y days have passed.

Is this method possible to implement given that each Braintree transaction seems to require a payment nonce? If not, can anyone suggest an alternative solution?

Much thanks.

like image 550
sahil Avatar asked Mar 16 '23 00:03

sahil


1 Answers

To answer your question in your title in one sentence: NO, a payment nonce is NOT required for every transaction with Braintree.

Theoretically, it can be done by vaulting your buyer's payment method information into your Braintree account, and then charge with the vaulted payment method. A payment method is vaulted in Braintree with a token. The payment method token can then be used to make payments without requiring the buyer to be present.

However, the buyer must grant the payment method to you. This is typically done by the buyer providing his/her payment method information to you via a dropin form or a custom form, which returns a nonce and the information to you. This requires the buyer to be present.

I would suggest following the steps below of the Reference section of Braintree (https://developers.braintreepayments.com)

  • Transaction (how to make a basic one-time transaction)
  • Customer
  • Credit Card
  • Transaction (how to make a transaction without buyer presence)

PS, I said "theoretically" at the beginning, because if you can / cannot do it with vaulting, depends on your purchasing flow and also if your buyers are willing to do it that way.

PS again, vaulted payment method token can be used this way (in PHP):

Braintree_Transaction::sale(array(
        'amount' => '10.00',
        'paymentMethodToken' => $the_payment_method_token,
        'options' => array(
                'submitForSettlement' => true
        )
));
like image 51
golddc Avatar answered Mar 17 '23 13:03

golddc