What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Billing API 400 Bad Request

Billing API 400 Bad Request

pk7
Tourist
8 0 1

Howdy.

 

I cannot get billing api to work.

Every time I try to create charge, get 400 Bad Request in response, regerdless if I use test flag or no. 

The POST body seems to be ok, I tried many combinations and none of them worked 😞

 

Can you please give me a hint ? Bellow sample requests that did not work.

 

URL: https://xxx.myshopify.com/admin/api/2020-04/application_charges.json,

 

X-Request-Id: [df7907e3-661e-49b0-a858-4a3de71c20e3]

{
    "application_charge": {
        "name": "Super Duper Expensive action",
        "price": 100,
        "return_url": "http://super-duper.shopifyapps.com"
    }
}

 

X-Request-Id: [f66b21a7-46ab-4f87-a973-4b80bf3255d6]

{
    "application_charge": {
        "name": "Super Duper Expensive action",
        "price": 100,
        "return_url": "http://super-duper.shopifyapps.com",
        "test": true
    }
}

 

X-Request-ID: [c7a54b8b-b06f-4c8c-8b5f-e18672aea67f] 

{
    "application_charge": {
        "name": "Super Duper Expensive action",
        "price": 100,
        "return_url": "http://localhost:3000",
        "test": true
    }
}
Reply 1 (1)

pk7
Tourist
8 0 1

Ok, I solved it, it's second time I faced this issue 😞 
Springs RestTemplate adds additional HTTP headers, that are not allowed by shopify: Accept, Content-Length, Content-Type