#marco - stripe fees

1 messages · Page 1 of 1 (latest)

chilly summit
#

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:

next bear
#

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;

}
#

??

chilly summit
#

You can do it with the list request, too

next bear
#

how?

chilly summit
#

expand[]='data.charges.data.balance_transaction'

next bear
#

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);
#

?

chilly summit
#

What do you mean where is it?

#

What are you trying to do?

next bear
#

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

chilly summit
#

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?

next bear
#

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?

chilly summit
#

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).

next bear
#

ok one problem at a time.

next bear
chilly summit
#

You can still add those params, why do you say you can't?

next bear
#

in PaymentIntentListParams how do I set the time range?

next bear
#

ok but this is for start range only not end

#

or not?

chilly summit
#

It supports both, all the same parameters as you were using

#

setGte and setLte

next bear
#

but not addexpand in this

chilly summit
#

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()
next bear
#

perfect

#

very kind

chilly summit
#

NP!

next bear
#

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?

chilly summit
#

The same way, after the payment is complete you request the charges.data.balance_transaction via expansion

next bear
#

but in test mode a payment intent how can I complete it? and to check the status?

chilly summit