ADMIN REST API Not getting payment url for created order

Hi I am trying to create an order using Rest Admin API. Order creation was success but didn’t receive payment URL for the order in response.

Following API are used.

order API

POST : https://shop.myshopify.com/admin/api/2023-04/orders.json

BODY:
{
"order": {
"line_items": [
{
"variant_id": 44598046785811,
"quantity": 1
}
],
"customer": {
"email": "madhana.sohan@gmail.com"
},
"financial_status": "pending"
}
}

Status 201 created.

Checkout API

POST https://shop.myshopify.com/admin/api/2023-04/checkouts.json
BODY:
{
"checkout": {
"line_items": [
{
"variant_id": 44598046785811,
"quantity": 1
}
],
"email": "dummy@email.com",
"presentment_currency": "INR"
}
}

RESPONSE
{
"errors": "[API] This action requires merchant approval for write_checkouts scope."
}

So tried finding write_checkouts scope in Admin API configuration of my private app. But that scope is not listed in Admin API.

Payment Gateway used: Razor pay Secure.

Please suggest.

Hey @ShivamShukla1

I think you’ll want to use a Draft Order for this, which returns an invoice URL.

Thank you for your response Scott. I also tried using Draft Order API. But the invoice URL needs authentication. Invoice URL is redirected to login page and the user has to login for continuing to checkout page. Is there a way to bypass it.

Hi ShivamShukla1,

In order to create checkouts, your app needs to have the write_checkouts access scope, which is available for apps which are Sales Channels. You can follow this guide to create a Sales Channel which will open up the read and write checkouts scopes.

Hope this helps,

You might have this setting or this setting enabled.

I forgot to mention there’s also the Storefront API which allows you to create carts and send customers to checkout. You can generate a token with the admin API.