#fakhrul.islam

1 messages · Page 1 of 1 (latest)

inland archBOT
peak dagger
#

Hi

But the problem is that the recurring billing doesn't work
Can you share more details about your integration and what is the problem exactly ?

#

Are you willing to use Stripe Checkout or Stripe Elements ?

grizzled bison
#

Here is my code for last step of subscription

$subscription_product = \Stripe\Product::create(
[
'name' => 'New shop subscription for BUYNOIR',
'default_price_data' => [
'unit_amount' => ($cart['amount']*100),
'currency' => 'usd',
'recurring' => ['interval' => $cart['period_unit']],
],
'expand' => ['default_price'],
]
);

$subscription_price = \Stripe\Price::create([
'unit_amount' => ($cart['amount']*100),
'currency' => 'usd',
'recurring' => ['interval' => $cart['period_unit']],
'product' => $subscription_product->id,
]);

// Create a new customer object
$customerResponse = \Stripe\Customer::create([
'email' => Company::getCurrent()->email
]);

$result = \Stripe\Subscription::create([
'customer' => $customerId,
'items' => [[
'price' => $priceId,
]],
'payment_behavior' => 'default_incomplete',
'payment_settings' => ['save_default_payment_method' => 'on_subscription'],
'expand' => ['latest_invoice.payment_intent'],
'description' => 'Your subscription to package has been successfully processed and confirmed!',
]);

peak dagger
grizzled bison
#

Thank you very much.

peak dagger
#

Np!