简体   繁体   English

从 Braintree Transaction.search() 获取费用金额

[英]Get fee amount from Braintree Transaction.search()

Is it possible to get the Braintree fee amount while searching for transactions using Transaction.search() method?是否可以在使用Transaction.search()方法搜索交易时获得 Braintree 费用金额? I specifically use Braintree Node.js SDK API, so when I call the method:我专门使用了 Braintree Node.js SDK API,所以当我调用该方法时:

const gateway = braintree.connect({
    environment: braintree.Environment.Production,
    merchantId : process.env.BRAINTREE_merchantId,
    publicKey  : process.env.BRAINTREE_publicKey,
    privateKey : process.env.BRAINTREE_privateKey,
});

// start and end are well formatted dates, irrelevant here
const stream = gateway.transaction.search((search) => {
    search.createdAt().between(start, end)
});

let result = [];

stream.on("data", (transaction) => {
    result.push(transaction);
});
stream.on("end", () => {

    console.log(result[0]);

});
stream.on("error", reject);
stream.resume();

My console.log(result[0]) shows pretty big (160 lines of code) single transaction object, where transaction.serviceFeeAmount: null .我的console.log(result[0])显示了相当大的(160 行代码)单个transaction对象,其中transaction.serviceFeeAmount: null

 console.log({ "id": "1egncjr5", "status": "settled", "type": "sale", "currencyIsoCode": "EUR", "amount": "799.00", "merchantAccountId": "mycompanyEUR", "subMerchantAccountId": null, "masterMerchantAccountId": null, "orderId": "54144", "createdAt": "2018-03-07T08:55:09Z", "updatedAt": "2018-03-07T19:41:10Z", "customer": { "id": null, "firstName": null, "lastName": null, "company": "Kunlabora NV", "email": "client@email.com", "website": null, "phone": null, "fax": null }, "billing": { "id": null, "firstName": null, "lastName": null, "company": "Kunlabora NV", "streetAddress": "Veldkant 33 A", "extendedAddress": null, "locality": "Kontich", "region": null, "postalCode": "2550", "countryName": "Belgium", "countryCodeAlpha2": "BE", "countryCodeAlpha3": "BEL", "countryCodeNumeric": "056" }, "refundId": null, "refundIds": [], "refundedTransactionId": null, "partialSettlementTransactionIds": [], "authorizedTransactionId": null, "settlementBatchId": "2018-03-08_mycompanyEUR_ecwhvhcf", "shipping": { "id": null, "firstName": null, "lastName": null, "company": null, "streetAddress": null, "extendedAddress": null, "locality": null, "region": null, "postalCode": null, "countryName": null, "countryCodeAlpha2": null, "countryCodeAlpha3": null, "countryCodeNumeric": null }, "customFields": "", "avsErrorResponseCode": null, "avsPostalCodeResponseCode": "U", "avsStreetAddressResponseCode": "U", "cvvResponseCode": "M", "gatewayRejectionReason": null, "processorAuthorizationCode": "735709", "processorResponseCode": "1000", "processorResponseText": "Approved", "additionalProcessorResponse": null, "voiceReferralNumber": "", "purchaseOrderNumber": null, "taxAmount": "0.00", "taxExempt": false, "creditCard": { "token": null, "bin": "CENSORED", "last4": "CENSODER", "cardType": "MasterCard", "expirationMonth": "CENSORED", "expirationYear": "CENSORED", "customerLocation": "CENSORED", "cardholderName": "", "imageUrl": "https://assets.braintreegateway.com/payment_method_logo/mastercard.png?environment=production", "prepaid": "No", "healthcare": "No", "debit": "No", "durbinRegulated": "No", "commercial": "No", "payroll": "No", "issuingBank": "BNP PARIBAS FORTIS", "countryOfIssuance": "BEL", "productId": "MCB", "uniqueNumberIdentifier": null, "venmoSdk": false, "maskedNumber": "CENSORED", "expirationDate": "04/2020" }, "statusHistory": [ { "timestamp": "2018-03-07T08:55:10Z", "status": "authorized", "amount": "799.00", "user": "office@mycompany.com", "transactionSource": "api" }, { "timestamp": "2018-03-07T08:55:10Z", "status": "submitted_for_settlement", "amount": "799.00", "user": "office@mycompany.com", "transactionSource": "api" }, { "timestamp": "2018-03-07T19:41:10Z", "status": "settled", "amount": "799.00", "user": null, "transactionSource": "" } ], "planId": null, "subscriptionId": null, "subscription": { "billingPeriodEndDate": null, "billingPeriodStartDate": null }, "addOns": [], "discounts": [], "descriptor": { "name": null, "phone": null, "url": null }, "recurring": false, "channel": "woocommerce_bt", "serviceFeeAmount": null, "escrowStatus": null, "disbursementDetails": { "disbursementDate": null, "settlementAmount": null, "settlementCurrencyIsoCode": null, "settlementCurrencyExchangeRate": null, "fundsHeld": null, "success": null }, "disputes": [], "authorizationAdjustments": [], "paymentInstrumentType": "credit_card", "processorSettlementResponseCode": "", "processorSettlementResponseText": "", "threeDSecureInfo": null, "shipsFromPostalCode": null, "shippingAmount": null, "discountAmount": null, "paypalAccount": {}, "coinbaseAccount": {}, "applePayCard": {}, "androidPayCard": {}, "visaCheckoutCard": {}, "masterpassCard": {} })

Question: How do I get the transaction fee here?问题:我如何在这里获得交易费?

您可能会在 transactionFeeAmount 字段中找到它

This is the answer I received from Braintree support team:这是我从 Braintree 支持团队收到的答案:


Unfortunately no it is not possible to search for the Braintree fee amount using the API at this time ( meaning 14/05/2018 ). 不幸的是,目前无法使用 API 搜索 Braintree 费用金额即 14/05/2018 )。

You can calculate the fees for individual transactions by performing an Advanced Transaction Search.您可以通过执行高级交易搜索来计算单笔交易的费用。

  1. Log into the Control Panel登录控制面板
  2. Under Advanced Search, click Transactions在高级搜索下,单击交易
  3. Uncheck the box next to Creation date range取消选中创建日期范围旁边的框
  4. Check the box next to Disbursed date range选中已支付日期范围旁边的框
  5. Choose your desired date range选择您想要的日期范围
  6. Click Search点击搜索
  7. On the results page, click Download在结果页面上,单击下载
  8. Open the CSV file in the spreadsheet program of your choice在您选择的电子表格程序中打开 CSV 文件

From here, you can create additional columns for your transaction fees.从这里,您可以为您的交易费用创建额外的列。 To find your specific transaction fees, look at the Pricing Schedule on your statement.要查找您的具体交易费用,请查看您对账单上的定价表。 Make sure to round down, and then apply the fees to your individual transactions.确保四舍五入,然后将费用应用于您的个人交易。


So it looks like I am going to implement some PhantomJS module to do just that.所以看起来我要实现一些 PhantomJS 模块来做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Meteor Server中的Braintree Transaction.search - Braintree Transaction.search in Meteor Server 根据应用推荐的销售额自动收取交易费用 - Automatic transaction fee charge based on sales amount from app referral 如何使用BitcoinJS设置交易费用金额? - How to set amount of transaction fee using BitcoinJS? Braintree Node.js 无法让 transaction.sale 工作 - Braintree Node.js cannot get transaction.sale to work 在 solana 中调用 transaction.from() 后,有没有办法获取金额(我们在交易中发送的令牌数) - Is there any way to get amount(number of token we are sending in transaction) after calling transaction.from() in solana 在Braintree中与Paypal进行交易 - Transaction with Paypal in Braintree Braintree 的 PayPal 付款中未显示金额 - Amount not showing in PayPal payment in Braintree Braintree / Javascript:如何获取交易数据(卡和地址)以预先为客户进行先前的交易? - Braintree / Javascript: how to get transaction data (card and address) to prefill for customers with previous transactions? 如何从交易保存搜索/Suitescript 搜索中获取销售订单“shipaddresslist”值? - How to get Sales Order 'shipaddresslist' value from Transaction Saved Search/Suitescript Search? 未捕获(承诺中)错误:需要交易费用付款人 - Uncaught (in promise) Error: Transaction fee payer required
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM