Wordpress Gravity Forms - Stripe 插件:加税

Wordpress Gravity Forms - Stripe add-on: adding taxes

GF 和 Stripe 的新手,我正在尝试对 Stripe 付款加税,如下所示(来源 https://stripe.com/docs/billing/taxes/tax-rates

// Set your secret key. Remember to switch to your live secret key in production!
// See your keys here: https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('sk_test_4eC39HqLyjWDarjtT1zdp7dc');

$tax_rate = \Stripe\TaxRate::create([
  'display_name' => 'Sales Tax',
  'description' => 'SF Sales Tax',
  'jurisdiction' => 'CA - SF',
  'percentage' => 8.5,
  'inclusive' => false,
]);

但是,它没有指定 how/where 应该使用创建的 $tax_rate 对象。

我查看了可用的 GF 挂钩,但不确定在哪里进行调用。是否应该将其添加到收费元中,因为看起来这是从第 1328 行 @ https://github.com/masoninthesis/gravityformsstripe/blob/master/class-gf-stripe.php.

获取设置的地方
$charge_meta = array(
                'amount'      => $this->get_amount_export( $submission_data['payment_amount'], rgar( $entry, 'currency' ) ),
                'currency'    => rgar( $entry, 'currency' ),
                'description' => $this->get_payment_description( $entry, $submission_data, $feed ),
                'capture'     => false,
            );

第 1380 行显示了创建 Stripe 费用的调用。

$charge = \Stripe\Charge::create( $charge_meta );

Stripe 文档没有提到税收 属性 @ https://stripe.com/docs/api/orders/object.

如果有人能帮我解决丢失的拼图,我将不胜感激。谢谢!

税率 API 用于发票或订阅,而不是一次性收费。

对于一次性收费,您可以在将金额传递给收费创建请求时自行计算税费。