Closed mpapado3 closed 1 year ago
I am using below code to create new subscriptions
auth()->user()->newSubscription($course->name, $request->plan)->create($request->paymentMethod()->noProration();
The subscriptions are for a group of courses, each user can subscribe to 1 or more courses. Each subscription is for 1 month period and since they are recurring, some users choose to cancel their subscriptions before the end of the period they have paid and keep the subscription active (grace period).
Some users while making new subscriptions to the same or to other course where charged with less amount compared to the actual cost. When checked with Stripe the requests contain "proration_behavior": "create_prorations" instead of "none".
This code is incorrect. You need to set no proration before doing the create:
auth()->user()->newSubscription($course->name, $request->plan)->noProration()->create($request->paymentMethod());
I put it before the create and again the request that reached stripe is:
Request POST body { "cancel_at": "1721476223", "proration_behavior": "create_prorations" }
and the code used for the subscription:
auth()->user()->newSubscription($course->name, $request->plan)->noProrate()->create($request->paymentMethod);
Cashier Stripe Version
13.6
Laravel Version
8.40
PHP Version
8.0.30
Database Driver & Version
No response
Description
I am creating a new subscription and despite I use noProration() on the call, the request on the Stripe is reached as below:
If I put the proration on option as extra subscription option and if I put ex 'nano' instead of 'none' I get an error from stripe "Invalid proration_behavior: must be one of create_prorations, none, or always_invoice".
this is the code used:
Steps To Reproduce
create new subscription with below code: