Join us for an upcoming Shopify Partner webinar on February 27, 2024. Discover the latest Checkout Extensibility features, and deep dive on improvements to Shopify Functions and Web Pixels. Register now for either the 10am EST or 2pm EST sessions.
Solved

Payment API returns 500 Internal Server Error

camelmasa
Shopify Partner
83 10 27

We tried to call Payment API (Stores a credit card in the card vault) like the following.

curl -d '{"credit_card":{"number":"4242424242424242","first_name":"John","last_name":"Smith","month":"11","year":"21","verification_value":"123"}}' \
-X POST "https://elb.deposit.shopifycs.com/sessions" \
-H "X-Shopify-Access-Token: shpat_xxx"


HTTP 500 Internal Server Error
ID: 65e5bf49ca81dd3b-618210a4

Ref: https://shopify.dev/api/admin-rest/2021-10/resources/payment#[post]https://elb.deposit.shopifycs.com...

What should we do next step?

Accepted Solution (1)
camelmasa
Shopify Partner
83 10 27

This is an accepted solution.

@Maacck Thank you for replying.

 

I received an email from the Shopify CS team.

After some digging, I found the examples from the doc is a missing the Content-Type header,-H "Content-Type: application/json", and when added to the request everything worked as expected. It's also worth noting that aContent-Typeheader is required for any POST or PUT call that contains a request body with JSON.

Then, I tried that. I could get a session id.

View solution in original post

Replies 2 (2)

Maacck
Shopify Partner
22 1 4

I think you have to request for payment processing permission first.

camelmasa
Shopify Partner
83 10 27

This is an accepted solution.

@Maacck Thank you for replying.

 

I received an email from the Shopify CS team.

After some digging, I found the examples from the doc is a missing the Content-Type header,-H "Content-Type: application/json", and when added to the request everything worked as expected. It's also worth noting that aContent-Typeheader is required for any POST or PUT call that contains a request body with JSON.

Then, I tried that. I could get a session id.