403 forbidden errror while calling recurring_application_charges admin api from our application

403 forbidden errror while calling recurring_application_charges admin api from our application

skanyar
Shopify Partner
4 0 1

Hi, When we are calling recurring_application_charges.json admin api for a production store from our application we are getting the 403 forbidden error. 

But if we call the same admin api for our staging store, we got the 200 response code along with charge_id. The staging store is created under our partner account.

We have tested this using postman also.

Do we need to ask any permission from our client to make this work.

Replies 6 (6)

ssjoleary
Shopify Partner
2 0 1

Hi @skanyar , what type of app have you created in your staging and production stores?


I'm seeing the same responses as you for both staging and production stores with a Custom app. I created a Custom app and installed it to a staging/development store from within Partners Shopify and everything worked. I started seeing issues after I installed the Custom app to my production store with Custom Distribution link. It turns out that Custom apps can't use the Billing API in production, you'll need a Public app for that.

 

https://shopify.dev/docs/apps/distribution#capabilities-and-requirements

 

Happy to chat further if it's a Public app you're using in production!

Joyen
Shopify Partner
7 0 0

Hi,

 

I have exactly the same problem and both of my app are public app, the only difference is that, one is in submission process and one is not (because I planned on only using it for testing).
So the app for testing is working but the prod app is not...
This is driving insane for a few weeks actually...I've contact shopify directly many time, as it is a bug, but I always get the same reply, that they are not devs so they have no idea...
So in case there is some dev out there, it will help me so much if you know what's the problem with this...Because really I've tried everything and I'm 100% sure both app are exactly the same.
But because they are always saying that they have no idea and it's probably a problem on my side I've wasted a lot of time on this, but it's a problem on shopify core side...
Thanks a lot for your help

Joyen
Shopify Partner
7 0 0

Just to be clear, for the test app I haven't yet clicked on "choose distribution" in the config tab
But on the prod app I choose Public App and then I submit it for review because (i thought maybe by submitting it the problem would be gone)

Joyen
Shopify Partner
7 0 0

to be clearer here is the exact response I get with the header : 
(it feels like it's some cloudflare block but I've no idea)

{
"headers": {
"status": "HTTP/2 403 \r",
"date": "Fri, 21 Feb 2025 12",
"content-type": "text/html",
"x-sorting-hat-podid": "44",
"x-sorting-hat-shopid": "30714462253",
"vary": "Accept-Encoding",
"referrer-policy": "origin-when-cross-origin",
"x-frame-options": "DENY",
"x-shopid": "30714462253",
"x-shardid": "44",
"x-stats-userid": "",
"x-stats-apiclientid": "206248247297",
"x-stats-apipermissionid": "534288400429",
"x-shopify-api-version": "2025-01",
"http_x_shopify_shop_api_call_limit": "1/40",
"x-shopify-shop-api-call-limit": "1/40",
"strict-transport-security": "max-age=7889238",
"x-request-id": "962fe8d3-4f01-4f3b-9cbe-7ebf5ff60d07-1740140669",
"server-timing": "cfRequestDuration;dur=251.999855",
"content-security-policy": "default-src 'self' data",
"x-content-type-options": "nosniff",
"x-download-options": "noopen",
"x-permitted-cross-domain-policies": "none",
"x-xss-protection": "1; mode=block",
"reporting-endpoints": "shopify-csp=\"/csp-report?source%5Baction%5D=create&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Frecurring_application_charges&source%5Bsection%5D=admin_api&source%5Buuid%5D=962fe8d3-4f01-4f3b-9cbe-7ebf5ff60d07-1740140669\"",
"x-dc": "gcp-europe-west3,gcp-us-east1,gcp-us-east1",
"alt-svc": "h3=\"",
"cf-cache-status": "DYNAMIC",
"report-to": "{\"endpoints\"",
"nel": "{\"success_fraction\"",
"server": "cloudflare",
"cf-ray": "9156b6ae1df89b74-FRA"
},
"response": ""
}

GlennT
Shopify Partner
1 0 2

Hi Joyen, 

 

I had the same issue and found that once I had started the review process I started getting 403 response on setting up the recurring charge.

 

I found the issue is that the review will automatically set up the app as "Managed Pricing", which means the pricing / charges will be handled from the App Store rather than the app and any calls to create a charge pragmatically are now denied.

 

To fix this open the listing and click the Manage button in the Pricing Details section, then Settings in the top right and select Manual Pricing, then click Save.

 

This should fix the issue.

charles_tot
Shopify Partner
2 0 2

Thank you so much this solved my issue