how can I add a company as a logistics and delivery provider for my shop?

how can I add a company as a logistics and delivery provider for my shop?

bimingda
Shopify Partner
4 0 0

what I want to do?

 I want to  add a company as a logistics and delivery provider such as UPS for my shop, this company is my delivery provider.

 

my problem is :

I add a custom app for my shop. and the app  register a carrier service  to shopify successfully, the company name is "my carrier service", but I can't find it in the shipping carrier list company list(as blow).
(the app got the access scope "shipping"
 )

thank you!

bimingda_0-1719912677453.png

 

 

my code is like this:

 

public CarrierServiceBo createCarrierService(String name, String callBackUrl) throws IOException {
        String url = String.format(carrierServiceUrl, devStoreNo);
        Map<String, String> headers = new HashMap<>();
        headers.put("Content-Type","application/json");
        headers.put("X-Shopify-Access-Token", token);

        CarrierServiceCreateReq carrierServiceCreateReq = new CarrierServiceCreateReq();
        carrierServiceCreateReq.getCarrier_service().setName(name);
        carrierServiceCreateReq.getCarrier_service().setCallback_url(callBackUrl);

        HttpClientResult clientResult = HttpClientUtil.post(url, GSON.toJson(carrierServiceCreateReq), "application/json", headers);
        log.info("response: {}", GSON.toJson(clientResult));
        if (clientResult.getCode() != 201) {
            return null;
        }

        String content = clientResult.getContent();
        CarrierServiceBoRoot carrierServiceBoRoot = GSON.fromJson(content, CarrierServiceBoRoot.class);

        return carrierServiceBoRoot.getCarrier_service();
    }
Replies 2 (2)

Liam
Shopify Staff
2873 312 821

Hi Bimingda

 

Where exactly are you setting the company name as "my carrier service"?

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

bimingda
Shopify Partner
4 0 0

Dear @Liam, thanks for your reply.

the name "my carrier service" is set out the function createCarrierService like this.

 

 

CarrierServiceBo carrierServiceBo = carrierServiceBiz.createCarrierService("my carrier service", callBackUrl);

 

 

 

Have a nice day!