#marco - stripe fees
1 messages · Page 1 of 1 (latest)
Hey there marco, you can find the Stripe fees by examining the "balance transaction" within the Charge inside the payment intent like this example shows:
so i have to make a call for every single payment intent with that parameter? I now use this code to take them all and create a report
public JsonArray getStripePaymentsList(Long startParam, Long endParam) throws StripeException {
Map<String, Object> paramsAll = new HashMap<>();
paramsAll.put("limit", 100);
paramsAll.put("created[gte]", startParam);
paramsAll.put("created[lte]", endParam);
PaymentIntentCollection paymentIntents = PaymentIntent.list(paramsAll);
JsonArray arrayJ = paymentIntents.getRawJsonObject().getAsJsonArray("data");
return arrayJ;
}
??
You can do it with the list request, too
how?
these are just wrapped in another data layer as documented:
https://stripe.com/docs/expand#lists
expand[]='data.charges.data.balance_transaction'
yes but where in this call?
Map<String, Object> paramsAll = new HashMap<>();
paramsAll.put("limit", 100);
paramsAll.put("created[gte]", startParam);
paramsAll.put("created[lte]", endParam);
PaymentIntentCollection paymentIntents = PaymentIntent.list(paramsAll);
?
i should print all i paymentintent. For each I need id, amount, customer, date, and the commission that stripe was taken on that payment. I have everything but I don't take the commission
this is my function
?
OK, and which part are you having trouble with?
I've shared the explanation of where/how you can inspect the Stripe fees. Did you add this to your request?
yes, now I have two problems. 1 with the "PaymentIntentParams" I no longer have the possibility to set the time range that I previously set with "created [gte]" and "created [lte]" in the map
2 how can I put the commission info in the payment intent that I generate myself for testing?
I no longer have the possibility to set the time range
Why do you say this? Nothing else changes about the List request.
how can I put the commission info in the payment intent that I generate myself for testing
Can you say more? What are you trying to do?
If you mean how to do include this when collecting new payments, you have to first recognize that it's only available after the payment is complete, not before. So you can retrieve it post-confirmation (following a successful auth).
ok one problem at a time.
before I had a map like this to manage the range, now passing the PaymentIntentListParams I don't have such a function.
You can still add those params, why do you say you can't?
in PaymentIntentListParams how do I set the time range?
but not addexpand in this
What do you mean?
There will be (at least) two builders: one for the list params, and one for the nested created filters
PaymentIntentListParams.builder()
.addExpand(...)
.setCreated(PaymentIntentListParams.Created.Builder().setGte(...).setLte(...).build())
// ... any other params
.build()
NP!
second problem
I created payment intents (see code)
PaymentIntentCreateParams paramsPay = PaymentIntentCreateParams
.builder()
.setCustomer(customerID)
.setCurrency("eur")
.setAmount(amount)
.addPaymentMethodType("card")
.setSetupFutureUsage(PaymentIntentCreateParams.SetupFutureUsage.ON_SESSION)
.build();
PaymentIntent paymentIntent = PaymentIntent.create(paramsPay);
how can i take this payment and get net income and stripe commission?
The same way, after the payment is complete you request the charges.data.balance_transaction via expansion
but in test mode a payment intent how can I complete it? and to check the status?
What are you trying to test? If you're following our guides eg for customer payment:
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
then you can use any of the test cards here, depending on the outcome you want:
https://stripe.com/docs/testing
The 4242 card is the "basic" test that always succeeds.