CORS issue + Rails + Billing Confirmation URL

CORS issue + Rails + Billing Confirmation URL

abhimanyubv
Shopify Partner
3 0 0

I have implemented https://shopify.dev/api/admin-rest/2022-10/resources/recurringapplicationcharge#post-recurring-appli... and while redirecting the store admin to confirmation url in the billing response, I am facing CORS issue.

 

Access to fetch at 'https://abc.myshopify.com/admin/charges/11/22/RecurringApplicationCharge/confirm_recurring_applicati...' (redirected from 'http://localhost:3000/?embedded=1&hmac=aa&locale=en&plan_id=1&session=aa&shop=abc.myshopify.com&time...') from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

 

I am using rails 7, added rack-cors gem and the cors.rb initializer has
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :post, :patch, :put, :options]
end
end


How to fix this issue?

Replies 0 (0)