简体   繁体   中英

Which Braintree API to use to pay multiple vendors at checkout

I am hoping to gain some "direction" about how to go about accomplishing this in Braintree :

I have a website where multiple vendors can sell their products. A customer can add to cart items from multiple vendors. If there are items from 2 vendors then, at checkout, the payment should get split into two recipients. Which API can I use to accomplish this in Braintree? Most of the examples and resources I have read have only one recipient. Would you guys have some example code with multiple recipients?

Full disclosure: I work at Braintree. If you have any further questions, feel free to contact support .

Currently there is no way to do multi-seller cart checkouts with only one Transaction.sale call.

If you want to send payment to multiple merchants in Marketplace and do not mind having multiple transactions recorded, you can call Transaction.sale multiple times, substituting the merchant_account_id for the current merchant account id. Also note that you'll need a payment_method_token that you can find more info on here

result = Braintree::Transaction.sale(
  :merchant_account_id => "provider_sub_merchant_account",
  :amount => "10.00",
  :payment_method_token => "payment_method_token",
  :service_fee_amount => "your_service_fee"
)

For more info on Marketplace, please check out the Braintree documentation .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM