#LucaW-3DS-Subscriptions

1 messages ยท Page 1 of 1 (latest)

hazy wing
abstract panther
#

Hi again Toby ๐Ÿ™‚

#

This is the flow:

hazy wing
#

Hi ๐Ÿ‘‹

abstract panther
#

Hi,

I get the setup intent with this function(CheckoutApi.getSetupIntent):
Return \Stripe\SetupIntent::create([
'customer' => $customer->id,
'payment_method_types' => ['card'],
'usage' => 'off_session',
]);

CheckoutApi.getSetupIntent(
  this.state.userData.email
  ).then(setupIntentResponse => {
    this.props.stripe.confirmCardSetup(setupIntentResponse.client_secret, {
      payment_method: {
        card: cardElement,
      },
    }).then(cardSetupResponse => {
      const paymentMethodId = cardSetupResponse.setupIntent.payment_method;
โ€ฆ.
        $subscription = \Stripe\Subscription::create([
        'customer'               => $customer->id,
        'default_payment_method' => $paymentMethodId,
        'items'                  => [
            [
                'price_data' => [
                    'unit_amount' => $monthlyAmount->asCents(),
                    'currency'    => 'eur',
                    'product'     => $product_id,
                    'recurring'   =>
                        ['interval' => 'month']
                ],
            ]
        ],
        "application_fee_percent" => $totalPercentage,
        "transfer_data" => [
            "destination" => $partnerStripeAccount->getStripeUserId(),
        ],
        "metadata" => $metadata,
    ]);

โ€ฆ.
    })
  })
abstract panther
#

Let me know if this is clear

hazy wing
abstract panther
#

๐Ÿ™‚

#

Now it works

#

Thanks a lot mate Toby from Rick and Morty!