#marco.melillo-earnings
1 messages · Page 1 of 1 (latest)
Hi! FYI we have a Stripe product that can help with this: https://stripe.com/sigma
Otherwise if you want to do that manually, then you have a few options:
- List all the PaymentIntents (like you suggested)
- List all the charges
- List all balance transactions
yes I have tried with the paymentintent and I can get the list and the parameters I need except the commissions
By commission you mean the Stripe fee?
The PaymentIntent object has a charge parameter, the Charge object has a balance_transaction parameter. And the BalanceTransaction object has a fee parameter.
And you can get that information in a single API call using expand: https://stripe.com/docs/expand
Is this Java? I'm not familiar with this language. Are you getting an error when running this code?
no but the fee is always 0. I think that being tested with paymentintents created by me, the fee will not come out if I don't confirm them somewhere. right ?
Can you share a PaymentIntent ID (pi_xxx)?
pi_3KCNDiIeBM9JjIfS2TuWHiTb
This PaymentIntent has status: requires_payment_method, so it has no charges, which means there are no fees.
You need to only look at PaymentIntent with status: succeeded.
Also, are you aware that you can export a csv of all your payments, including the stripe fees, directly from the Stripe dashboard?
yes so when i create a payment intent can set status succeeded ?only for test.
I read that by inserting a particular card as a payment method, the payment was automatically accepted ... right?
That depends on which test card(s) you're using?
this is my paymentintent creator
if i set this card, the status change in succeeded automatically
^^
Ok, so you're creating a Payment Intent. You need to actually provide a Payment Method
Which card? There's dozens there that simulate different scenarios
in the same call?
You can yes: https://stripe.com/docs/api/payment_intents/create#create_payment_intent-payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
But that's now how a real, live integration would work. You'd generally collect payment details from your customer and pass when confirming: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-collect-payment-details
I created and approved a payment but it doesn't come out. in the call for the paymentintent list there is a field to take only those with status success?
but it doesn't come out
I'm not sure what that means
in the call for the paymentintent list there is a field to take only those with status success
There's nostatusfilter parameter no
so how can i get the list of successfully completed transactions?
What are you looking to do/build?
i should print all my earnings in a time range. For each I need id, amount, customer, date, and the commission that stripe was taken on that payment
You should look at using the Balance Transactions API: https://stripe.com/docs/api/balance_transactions/list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I have seen, but it seems to me that with this I have no customer data or am I wrong?
It'll be there, but deeply nested on the corresponding Charge object. Which you can expand: https://stripe.com/docs/expand
can you give me an example? it's not clear to me
Are you using one of our client libraries?
yes
Which..?
<dependency>
<groupId>com.stripe</groupId>
<artifactId>stripe-java</artifactId>
<version>20.93.0</version>
</dependency>
List<String> expandList = new ArrayList<>();
expandList.add("source.customer");
Map<String, Object> params = new HashMap<>();
params.put("expand", expandList);
params.put("type", "charge");
BalanceTransactionCollection balanceTransactions =
BalanceTransaction.list(params);
Maybe something like that will get you started
You can use the created parameter to filter to a date range: https://stripe.com/docs/api/balance_transactions/list?lang=java#balance_transaction_list-created
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
ok very kind, I'll try this and let you know
not work
yep, as the error says, you want data.source
yes now work
so on line 33 you should use "data.source.customer"