Kyon147/laravel-shopify

Usage Charges Redirecting to Blank Page

koraysari opened this issue · 5 comments

https://github.com/Kyon147/laravel-shopify/wiki/Creating-a-Billable-App#creating-usage-charges
I followed the instructions provided in the "Creating Usage Charges" section of the Laravel Shopify package documentation to create a usage charge for my app

Expected Behavior

When trying to create usage charges for a shop that is on a recurring plan with usage charge abilities, I expect to be directed to a payment confirmation page where the shop can approve the charge.

Current Behavior

Instead of being redirected to a payment page, the process redirects to an empty page, and no interaction with a payment or approval interface occurs. However, the charge seems to be stored in the database as if it had been approved.

Context

  • Package Version: v20.0.0
  • Laravel Version: v8.83.27
  • PHP Version: v8.1
  • Template Engine: Blade

Failure Logs

$usageChargeRoute = route('billing.usage_charge', array_merge($charge, ['signature' => $signature->toNative()]));
usageChargeRoute URL attempted for usage charges: https://feedimize.fullyfeed.com/billing/usage-charge?description=$1%20per%20additional%201%2C000%20products&price=1&redirect=https%3A%2F%2Ffeedimize.fullyfeed.com&signature=a45c16e3a15e8326e4d6dee7812339e4f7f9cc966c417face1256d26dd52d885&shop=fully-feed.myshopify.com

image

You are using the route() method but you need to make sure you pass the host param along with every request.

If you look in your console you'll likely see an error with app bridge missing the host param.

Please read the wiki for more https://github.com/Kyon147/laravel-shopify/wiki/Authentication-Process

Closing as inactive, re-open if you still have an issue.

Based on the documentation's recommendations, I utilized the URL::tokenRoute method to construct the usage charge link. The host parameter is now included in the URL. The newly generated link was as follows:

href="https://feedimize.fullyfeed.com/authenticate/token?shop=fully-feed.myshopify.com&target=https%3A%2F%2Ffeedimize.fullyfeed.com%2Fbilling%2Fusage-charge%3Fdescription%3DFive%2520e-mails%26price%3D1%26redirect%3Dhttps%253A%252F%252Ffeedimize.fullyfeed.com%26signature%3D0c7feec84b957578c5352e6ba3231fcfe4a3904096723558dcf0dfff1e7dd6df&host=YWRtaW4uc2hvcGlmeS5jb20vc3RvcmUvZnVsbHktZmVlZA"

Unfortunately, even after implementing the usage charge link via the URL::tokenRoute, the issue persisted, leading to the same outcome of being redirected to a blank page without any visible error messages in the console.

image

It looks like your redirect string is not right as some is encoded and some is not, mainly the host and shop param.

How are you building it?

Closing stale ticket, reopen if issue still happens