Closed sil2 closed 11 months ago
In the free plan, there's no requirement to add Shopify billing. The best idea is to follow one process outlined in your free plan to access an app.
Thanks for the quick response. this is exactly what I was going to do if I didn't get advice from you. There is one nuance. If I start processing the free plan myself, the request for billing/1 will still throw an error.
According your documentation here https://github.com/gnikyt/laravel-shopify/wiki/Creating-a-Billable-App
If you plan on creating a "free" recurring plan, and only utilizing usage charges, then you must set the plan's price to 0.00, set the capped_amount and the terms for Shopify to accept the 0.00 charge through the API.
This become all wrong. Shopify API require price to be > $0.5 US.
I can assign price_id = 1 on new user create, but there will be no charges in the DB and shopify API will have no idea about charges and plans for this user. As the result -> non of your logic will work.
Second....
idea of setting shopify_freemium =1 for the user is not the best too because Ill need to handle future plan updates for this user somehow manually, also.
it is all on you, but i would reccomend to update your logic and bypass new charge creation if price = 0 but just assign the plan
@sil2 try setting the capped amount to 0.00
I think they updated it to not allow a capped amount at 0
.
When I create a monthly recurring free plan, this is what I do.
Closing this for now but reopen if my suggestion does not work
@sil2 let's use my solution works https://github.com/Kyon147/laravel-shopify/issues/258 ;)
I created FREE plan with type ONETIME and price 0.00, on_install = 1
On my app install no plans getting assigned. By trying to call billing/1 (1 is my free plan ID) I'm getting RequestException
Client error:
POST https://###.myshopify.com/admin/application_charges.json
resulted in a422 Unprocessable Entity
response: {\"errors\":{\"price\":[\"must be greater than or equal to the equivalent of $0.50 USD\"]}} at /###/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)I try to set plan to RECURRING, same error,
I added SHOPIFY_BILLING_FREEMIUM_ENABLED = 1, same :(
What I see from the code,
Traits/BillingController.php(52) index method calls GetPlanUrl()
Actions/GetPlanUrl.php(82) calls
Services/ApiHelper.php(265) createCharge() method
runs API request to create a new charge with 0 price (in my case)
$response = $this->doRequest( ApiMethod::POST(), "/admin/{$typeString}s.json", [$typeString => $payload->toArray()] );
throws this error.
I see 0 logic to avoid to create charges for free plans.
How come?
Can you help pls? What I'm missing here?
Should I do no calls for billing for free plans? How to assign my free plan then?
How on_install should work for free plan?
Laravel 10.28, "kyon147/laravel-shopify": "^19.1.0",
This issue is related to 0 price plan only. All my other plans works well.
btw, doRequest() method can return $response['body'] not as a string but array. 'Unknown error' is not a best way to see what's really going on here.
in my case, as you can see the body is
"body":{"price":["must be greater than or equal to the equivalent of $0.50 USD"]},