Stripe API 如何从一个收费对象中扣除申请费?
How to deduct an application fee from a charge object in Stripe API?
客户 1 在扣除 (平台费用 + 条纹费用)。到运行这样的场景。我在 Stripe-Connect
:
中执行了以下步骤
- 创建了一个 Customer1 对象并添加了卡片信息。
- 使用端点为 Customer2 创建了一个帐户:https://stripe.com/docs/api#create_account
我可以在 Connected account
部分看到创建的帐户。
从浏览器本身进入测试 Legal entity
后验证帐户。
正在创建一个 Charge
对象(Customer1 正在付款),它也有一个 application_fee
。请求中提到的目标帐户是新生成的 Customer2
帐户。
我正在使用 Java
API,它向我抛出一个错误:
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
我试图在 Whosebug
上跟进,看来我需要创建一个 platform account
来发起此类收费。如果是这样,我如何创建 Platform account
?
扣除application_fee
后,如何帮助我充值Customer1
并转入Customer2
connect
账户?
这听起来有点让我困惑。任何帮助或提示将不胜感激。
您在这里已有平台账号。这只是用于描述已连接帐户的主帐户(您的)的词。
这里的问题似乎与您创建 Charge 的方式有关。如果您明确代表关联账户提出申请,您只能收取申请费。目前有两种方法可以做到这一点:
- Destination 费用通过平台,资金自动发送到关联账户
- Direct 费用直接在连接的帐户上创建,申请费会发回给您。
由于您使用的是 Custom 帐户,您可以在其中为您的卖家创建和拥有帐户,因此您应该使用第一种方法。在这种情况下,您甚至不必支付申请费。相反,您只需在创建费用时决定向连接的帐户发送多少。这个想法是你收取 100 美元,你只向关联账户发送 90 美元,这样你就可以为自己保留 10 美元(减去 Stripe 的费用)。
代码如下所示:
// Create the list of parameters for the charge
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 10000); // amount to charge in cents
params.put("currency", "usd");
params.put("source", "tok_visa");
// Decide how what to send to the connected account
Map<String, Object> destinationParams = new HashMap<String, Object>();
destinationParams.put("account", "acct_XXXXX"); // connected account id
destinationParams.put("amount", 9000); // amount to send to the connected account
params.put("destination", destinationParams);
Charge charge = Charge.create(params);
客户 1 在扣除 (平台费用 + 条纹费用)。到运行这样的场景。我在 Stripe-Connect
:
- 创建了一个 Customer1 对象并添加了卡片信息。
- 使用端点为 Customer2 创建了一个帐户:https://stripe.com/docs/api#create_account
我可以在
Connected account
部分看到创建的帐户。从浏览器本身进入测试
Legal entity
后验证帐户。正在创建一个
Charge
对象(Customer1 正在付款),它也有一个application_fee
。请求中提到的目标帐户是新生成的Customer2
帐户。
我正在使用 Java
API,它向我抛出一个错误:
Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).
我试图在 Whosebug
上跟进,看来我需要创建一个 platform account
来发起此类收费。如果是这样,我如何创建 Platform account
?
扣除application_fee
后,如何帮助我充值Customer1
并转入Customer2
connect
账户?
这听起来有点让我困惑。任何帮助或提示将不胜感激。
您在这里已有平台账号。这只是用于描述已连接帐户的主帐户(您的)的词。
这里的问题似乎与您创建 Charge 的方式有关。如果您明确代表关联账户提出申请,您只能收取申请费。目前有两种方法可以做到这一点:
- Destination 费用通过平台,资金自动发送到关联账户
- Direct 费用直接在连接的帐户上创建,申请费会发回给您。
由于您使用的是 Custom 帐户,您可以在其中为您的卖家创建和拥有帐户,因此您应该使用第一种方法。在这种情况下,您甚至不必支付申请费。相反,您只需在创建费用时决定向连接的帐户发送多少。这个想法是你收取 100 美元,你只向关联账户发送 90 美元,这样你就可以为自己保留 10 美元(减去 Stripe 的费用)。
代码如下所示:
// Create the list of parameters for the charge
Map<String, Object> params = new HashMap<String, Object>();
params.put("amount", 10000); // amount to charge in cents
params.put("currency", "usd");
params.put("source", "tok_visa");
// Decide how what to send to the connected account
Map<String, Object> destinationParams = new HashMap<String, Object>();
destinationParams.put("account", "acct_XXXXX"); // connected account id
destinationParams.put("amount", 9000); // amount to send to the connected account
params.put("destination", destinationParams);
Charge charge = Charge.create(params);