【问题标题】:Integrate iDeal with Stripe Connect To Split Payments将 iDeal 与 Stripe Connect 集成以拆分付款
【发布时间】:2021-02-23 07:30:32
【问题描述】:

我正在使用集成了 Stripe Connect 的 Dokan Pro 运行一个市场网站。现在我想将 iDeal 与它集成,但他们没有正式拥有它,所以我正在按照 Stripe 的文档进行一些自定义编码,但到目前为止我无法实现任何目标。

Stripe 为我提供了以下文档:

https://stripe.com/docs/connect/direct-charges#create-a-charge

Stripe For Woocommerce 上有一个官方插件,它也有 iDeal 选项,但问题是它不能拆分付款,因为它不适用于 Stripe Connect。我确实尝试编辑它的代码,但是当我发送 application_fee 参数时它给了我一个错误。代码如下:

public function create_source( $order ) {
    $currency              = $order->get_currency();
    $return_url            = $this->get_stripe_return_url( $order );
    $post_data             = array();
    $post_data['amount']   = WC_Stripe_Helper::get_stripe_amount( $order->get_total(), $currency );
    $post_data['currency'] = strtolower( $currency );
    $post_data['type']     = 'ideal';
    $post_data['application_fee_amount']     = '10';
    $post_data['owner']    = $this->get_owner_details( $order );
    $post_data['redirect'] = array( 'return_url' => $return_url );

    if ( ! empty( $this->statement_descriptor ) ) {
        $post_data['statement_descriptor'] = WC_Stripe_Helper::clean_statement_descriptor( $this->statement_descriptor );
    }

    WC_Stripe_Logger::log( 'Info: Begin creating iDeal source' );

    return WC_Stripe_API::request( apply_filters( 'wc_stripe_ideal_source', $post_data, $order ), 'sources' );
}

任何帮助将不胜感激。

【问题讨论】:

  • 您能否分享您收到的错误详细信息,并详细说明您所说的“拆分付款”是什么意思?我将在下面做一些假设和回答,但如果需要会更新。

标签: stripe-payments dokan


【解决方案1】:

假设:我假设“拆分付款”是指当客户向您的平台进行单笔订单/付款时处理的,其中包括来自多个提供商的商品/服务。您需要分配付款并将部分付款发送到多个目的地帐户。

我认为让您感到困难的几件事:

  • 我建议查看更新后的Payment Intents guide for iDEAL,而不是来源。您应该会发现这与 Stripe API 的所有最新文档更加一致。
  • 如果您打算将付款分摊给多个收款人,您将无法通过直接收费来执行此操作。相反,您应该使用"Separate Charges & Transfers" 允许您将部分付款发送给多个商品/服务提供商。

在服务器上:

// Create a PaymentIntent:
$paymentIntent = \Stripe\PaymentIntent::create([
  'amount' => 10000,
  'currency' => 'eur',
  'payment_method_types' => ['ideal'],
  'transfer_group' => 'YOUR_ORDER_ID_123',
]);

// Send $paymentIntent->client_secret to the client

在客户端:

//HTML
<div id="ideal-bank-element">
  <!-- A Stripe Element will be inserted here. -->
</div>

//JS
// Create an instance of the idealBank Element
var idealBank = elements.create('idealBank', options);

// Add an instance of the idealBank Element into
// the `ideal-bank-element` <div>
idealBank.mount('#ideal-bank-element');
...
    stripe.confirmIdealPayment(
    '{{PAYMENT_INTENT_CLIENT_SECRET}}',
    {
      payment_method: {
        ideal: idealBank,
        billing_details: {
          name: accountholderName.value,
        },
      },
      return_url: 'https://your-website.com/checkout/complete',
    }
  );

在服务器上,稍后:

// Create a Transfer to a connected account (later):
$transfer = \Stripe\Transfer::create([
  'amount' => 7000,
  'currency' => 'eur',
  'destination' => 'acct_123',
  'transfer_group' => 'YOUR_ORDER_ID_123',
]);

// Create a second Transfer to another connected account (later):
$transfer = \Stripe\Transfer::create([
  'amount' => 2000,
  'currency' => 'eur',
  'destination' => 'acct_456',
  'transfer_group' => 'YOUR_ORDER_ID_123',
]);

【讨论】:

  • 感谢您的详细回答。让我给你一些解释。所以我在我的网站上使用 Dokan Pro,它集成了一个模块 Stripe Connected。它支持卡支付并将它们正确拆分到我们连接的 Stripe 连接。我希望通过 iDeal 获得 Dokan 未集成的相同功能。我与 Stripe 交谈过,他们向我提供了我在上面分享的文档,所以我只需要一个线索,应该在代码中发生拆分,这样我就可以有一个想法并将其与 iDeal 集成。
  • 是的,那我回答的就是你需要的。单独收费和转账是如何拆分付款。
猜你喜欢
  • 2017-04-27
  • 2019-09-13
  • 1970-01-01
  • 2020-09-18
  • 2016-05-23
  • 2021-12-27
  • 2015-06-01
  • 1970-01-01
  • 2017-04-16
相关资源
最近更新 更多