#al_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1331082939102003250
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
hello! which country is your platform based in? e.g. US? DE? or...?
Hello, our project is deployed in the United States, so it is located in the United States
it's really where your business is registered than where the project is deployed.
If you are using a US Stripe account, you can retrieve the balance using https://docs.stripe.com/api/balance/balance_retrieve, and add funds via the Top Ups API : https://docs.stripe.com/api/topups
There's a bit more detail here : https://docs.stripe.com/connect/top-ups
We don't recharge Stripe ourselves, we want to use the interface to directly deduct the user's Stripe
i'm afraid I don't quite understand, maybe can you illustrate / share more details with an example?
For example, when our platform detects that the user's balance is less than 50, we will use the stripe API to deduct the payment from stripe, which is equivalent to helping the user use stripe to recharge our platform. I want to know which one should I use for this automatic deduction API?
who is the user in this case?
do you mean a connected account?
or do you mean a customer?
User refers to the customer of our platform
We want to use the Stripe API to help users deduct Stripe payments, and the deducted money will be directly transferred to the existing Stripe account on our platform
this is a public channel, please don't paste your secret key
you should never share your secret API keys over an insecure medium, regardless of whether it's a test or live mode key. I strongly suggest you roll your test mode key immediately as the one you sent is now considered compromised: https://dashboard.stripe.com/test/apikeys
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
since it sounds like you want to charge the customer off-session (while they're not on your site). I'd recommend referring to these guides to get started :
- https://docs.stripe.com/payments/save-and-reuse
- https://docs.stripe.com/payments/save-during-payment
Depending on which kind of integration flow you choose, you can get up and running quickly using
Stripe.apiKey = "sk_test_****";
Map<String, Object> params = new HashMap<>();
params.put("customer", "cus_RbLJx6IcxqMqf5");
params.put("application_fee_amount", 10);
params.put("collection_method", "charge_automatically");
Map<String, Object> transferData = new HashMap<>();
// transferData.put("destination", "acct_****"); // 确保这是正确的连接账户ID
// transferData.put("amount", 10); // 可选的,如果你想指定转账金额
params.put("transfer_data", transferData);
RequestOptions requestOptions = RequestOptions.builder().setStripeAccount("acct_***").build();
Invoice invoice = Invoice.create(params, requestOptions);
We want to use this API to deduct money
Is this correct?
are all of your connected accounts based in the US also?
Yes
the code snippet you shared doesn't deduct money from the customer.
What you want to do is really a combination of the guides I mentioned above ([here](#1331082939102003250 message)) and selecting the appropriate type of charge here : https://docs.stripe.com/connect/charges#types.
In short, you need to have a form to collect and save the payment method details, and then charge the customer. I suggest starting off with understanding how to collect the payment method details and charging the customer first, then understanding how how to transfer those funds to the connected account
I found that the method I took a screenshot of can be used to deduct money from customers. Which API should I use?