33
33
use Stripe \InvoiceItem ;
34
34
use Stripe \Refund ;
35
35
use Stripe \Source ;
36
+ use Stripe \Subscription ;
36
37
use yii \base \Component ;
37
38
use enupal \stripe \records \Order as OrderRecord ;
38
39
use enupal \stripe \records \Customer as CustomerRecord ;
@@ -1160,6 +1161,7 @@ private function addPlanToCustomer($customer, $planId, $data, $order)
1160
1161
1161
1162
// Add the plan to the customer
1162
1163
$ subscriptionSettings = [
1164
+ "customer " => $ customer ->id ,
1163
1165
"plan " => $ planId ,
1164
1166
"trial_from_plan " => true ,
1165
1167
'metadata ' => $ this ->getStripeMetadata ($ data )
@@ -1183,8 +1185,7 @@ private function addPlanToCustomer($customer, $planId, $data, $order)
1183
1185
}
1184
1186
1185
1187
$ subscriptionSettings ['metadata ' ] = $ this ->getStripeMetadata ($ data );
1186
-
1187
- $ subscription = $ customer ->subscriptions ->create ($ subscriptionSettings );
1188
+ $ subscription = Subscription::create ($ subscriptionSettings );
1188
1189
1189
1190
return $ subscription ;
1190
1191
}
@@ -1243,6 +1244,7 @@ private function addRecurringPayment($customer, $data, $paymentForm, $order)
1243
1244
1244
1245
// Add the plan to the customer
1245
1246
$ subscriptionSettings = [
1247
+ "customer " => $ customer ->id ,
1246
1248
"plan " => $ plan ['id ' ]
1247
1249
];
1248
1250
@@ -1258,7 +1260,7 @@ private function addRecurringPayment($customer, $data, $paymentForm, $order)
1258
1260
1259
1261
$ subscriptionSettings ['metadata ' ] = $ this ->getStripeMetadata ($ data );
1260
1262
1261
- $ subscription = $ customer -> subscriptions -> create ($ subscriptionSettings );
1263
+ $ subscription = Subscription:: create ($ subscriptionSettings );
1262
1264
1263
1265
return $ subscription ;
1264
1266
}
@@ -1303,6 +1305,7 @@ private function addCustomPlan($customer, $data, $paymentForm)
1303
1305
1304
1306
// Add the plan to the customer
1305
1307
$ subscriptionSettings = [
1308
+ "customer " => $ customer ->id ,
1306
1309
"plan " => $ plan ['id ' ],
1307
1310
"trial_from_plan " => true
1308
1311
];
@@ -1313,8 +1316,7 @@ private function addCustomPlan($customer, $data, $paymentForm)
1313
1316
}
1314
1317
1315
1318
$ subscriptionSettings ['metadata ' ] = $ this ->getStripeMetadata ($ data );
1316
-
1317
- $ subscription = $ customer ->subscriptions ->create ($ subscriptionSettings );
1319
+ $ subscription = Subscription::create ($ subscriptionSettings );
1318
1320
1319
1321
return $ subscription ;
1320
1322
}
0 commit comments