Capturing partial payments doest not work with Braintree as it does not support partial payments when auto_capture_on_dispatch = true.

616 views
Skip to first unread message

Kunal

unread,
May 20, 2015, 1:16:55 AM5/20/15
to spree...@googlegroups.com
Hello,

When auto_capture_on_dispatch = true and we have more than one shipments. Shipping any shipment will capture the amount = shipment total. This does not work with Braintree payment gateway as it does not support partial payment. So if you have authorized $100 while checkout and try to capture $50 and $50 in two transaction than it will not work.

So capture! on second attempt will raise below error.

Gateway Error
  --- !ruby/object:ActiveMerchant::Billing::Response
params:
  braintree_transaction: 
message: Cannot submit for settlement unless status is authorized. (91507)
success: false
test: false
authorization: 
fraud_review: 
avs_result:
  code: 
  message: 
  street_match: 
  postal_match: 
cvv_result:
  code: 
  message: 


I think shipment should be associated with the payments where payment amoumt  = shipment total and should be authorized for each shipments. So when particular shipment is shipped its associated authorized payment will be captured. 


This method here captures partial payments for shipments: https://github.com/spree/spree/blob/master/core/app/models/spree/shipment.rb#L185

Thanks,
Kunal

Kunal

unread,
May 20, 2015, 1:27:05 AM5/20/15
to spree...@googlegroups.com

jdutil

unread,
May 20, 2015, 12:48:18 PM5/20/15
to spree...@googlegroups.com
Since Braintree doesn't support multiple captures per authorization you will need to create a new purchase charge for follow up payments, and just let the remaining authorized amount expire from the first capture.

Kunal

unread,
May 20, 2015, 2:02:43 PM5/20/15
to spree...@googlegroups.com
Yep. This will require additional check to put for Braintree Payment Method. 

Lets say we have two shipments $50 so for first shipment charge will captured properly but on second shipment it will fail leaving admin of spree app in puzzle why it is not working.

I mean this thing is specific to payment method. Wouldn't be ideal to have capture logic in payment method itself just like purchase and authorize?

Or association between payment and shipment?

Kunal

unread,
May 21, 2015, 1:27:59 AM5/21/15
to spree...@googlegroups.com
Also moving capture to payment method like authorize and purchase method make sense as in case of paypal reference transaction it expect amount in USD. So if we send amount in cents than it happens to capture amount in USD. So in current situation we do capture with 866 cents for paypal than it will result in capture of $866. 
Reply all
Reply to author
Forward
0 new messages