#al_api

1 messages · Page 1 of 1 (latest)

cedar carbonBOT
#

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

rose idol
#

hello! which country is your platform based in? e.g. US? DE? or...?

pallid cave
#

Hello, our project is deployed in the United States, so it is located in the United States

rose idol
#

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

Platforms can add funds to their balance from a bank account.

pallid cave
#

We don't recharge Stripe ourselves, we want to use the interface to directly deduct the user's Stripe

rose idol
#

i'm afraid I don't quite understand, maybe can you illustrate / share more details with an example?

pallid cave
#

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?

rose idol
#

who is the user in this case?

#

do you mean a connected account?

#

or do you mean a customer?

pallid cave
#

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

rose idol
#

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

#

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 :

Depending on which kind of integration flow you choose, you can get up and running quickly using

Learn how to save payment details and charge your customers later.

Learn how to save payment details during a payment.

pallid cave
#

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?

rose idol
#

are all of your connected accounts based in the US also?

pallid cave
#

Yes

rose idol
#

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

Create a charge and split payments between your platform and your sellers or service providers.

pallid cave
#

I found that the method I took a screenshot of can be used to deduct money from customers. Which API should I use?