Skip to content

Instantly share code, notes, and snippets.

@Brotzka
Last active February 28, 2019 19:35
Show Gist options
  • Save Brotzka/d330368b1d03579ce92f13ba4e0175b4 to your computer and use it in GitHub Desktop.
Save Brotzka/d330368b1d03579ce92f13ba4e0175b4 to your computer and use it in GitHub Desktop.
FAAREN Subscription error
Stripe::setApiKey(config('services.stripe.secret'));
$subscription = $this->getSubscription(); // This is the subscription from our database
$customer = Customer::retrieve($subscription->consumer->stripe_id);
//dd($customer);
$plan = Plan::create([
'amount' => $subscription->price * 100,
'interval' => 'month',
'product' => $subscription->vehicle->stripe_id,
'currency' => 'eur',
'billing_scheme' => 'per_unit'
]);
$stripeSubscription = \Stripe\Subscription::create([
//'customer' => $subscription->consumer->stripe_id,
'customer' => $customer,
'application_fee_percent' => ($subscription->bookedMonth->faaren_surcharge - 1) * 100,
'billing' => 'charge_automatically',
'tax_percent' => 0,
'items' => [
['plan' => $plan->id]
]
], ["stripe_account" => $subscription->producer->stripe_id]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment