You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
Im trying to follow the documentation of usage charge, so i can charge users based upon their usage, i tried the following code from the docs
App/Http/Controllers/Example
...
public function index()
{
// Description and price of usage charge (the only two parameters required)
$charge = [
'description' => 'Five e-mails',
'price' => 1.00,
'redirect' => route('example.success') // Optional, if not supplied redirect goes back to previous page with flash success=true
];
// Create a signature to prevent tampering
$signature = createHmac(['data' => $charge, 'buildQuery' => true], Config::get('shopify-app.api_secret'));
// Create the route
$usageChargeRoute = route('billing.usage_charge', array_merge($charge, ['signature' => $signature]));
return view('example.index', compact('usageChargeRoute'));
}
But seems like this cod is out dated and it not work in v17, firstly i get an error saying that method createHmac do not exists, then after some research i used the Util helper to call this method, later on i got error saying shop is not found, and i look for package code and it was getting shop from request object, which was returning null value, so in order to handle it for a while i manually pass the shop just to keep it running, and it work successfully by creating a charge in charges table, but it do not redirects to billing page for confirmation, anyone have idea about this please help
The text was updated successfully, but these errors were encountered:
1.firstly i get an error saying that method createHmac do not exists, then after some research i used the Util helper to call this method
Later on i got error saying shop is not found, and i look for package code and it was getting shop from request object, which was returning null value, so in order to handle it for a while i manually pass the shop just to keep it running
So after some manual work, it work successfully by creating a charge in charges table, but it do not redirects to billing page for confirmation
Im trying to follow the documentation of usage charge, so i can charge users based upon their usage, i tried the following code from the docs
App/Http/Controllers/Example
...
public function index()
{
// Description and price of usage charge (the only two parameters required)
$charge = [
'description' => 'Five e-mails',
'price' => 1.00,
'redirect' => route('example.success') // Optional, if not supplied redirect goes back to previous page with flash
success
=true
];
}
But seems like this cod is out dated and it not work in v17, firstly i get an error saying that method createHmac do not exists, then after some research i used the Util helper to call this method, later on i got error saying shop is not found, and i look for package code and it was getting shop from request object, which was returning null value, so in order to handle it for a while i manually pass the shop just to keep it running, and it work successfully by creating a charge in charges table, but it do not redirects to billing page for confirmation, anyone have idea about this please help
The text was updated successfully, but these errors were encountered: