Sync the delivery price of a subscription contract from Shopify
Recalculates the delivery price of a subscription contract from your Shopify shipping rates. This is the same sync as the Sync button in the Delivery Information section of the subscription in the merchant portal.
The request is accepted at once and the sync runs in the background. A 202 response means that the sync was
accepted, not that it is done. The contract’s current delivery price does not show whether the sync is done,
because a finished sync can leave the price as it was. Most results show in the activity log
(GET /api/external/v2/activity-logs?entityId.equals=<contractId>&eventType.equals=SYSTEM_UPDATED_DELIVERY_PRICE).
A sync that is still waiting when the app restarts does not run.
Limit: each shop gets one accepted request every 10 seconds, for all of its API keys and contracts. The other
requests in that time get 429 with a Retry-After header.
Not synced (400):
- The contract uses a custom delivery price (
allowDeliveryPriceOverrideis true). To sync it, first turn this off withPUT /api/external/v2/subscription-contracts-update-delivery-price-override. - “Use custom shipping rates (instead of Shopify calculations)” is on in Shop Settings.
Authentication is enforced via the X-API-Key header (the ‘api_key’ parameter is deprecated). Read-only API keys get 403.
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-priceimport requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price"
response = requests.put(url)
print(response.text)const options = {method: 'PUT'};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price';
const options = {method: 'PUT'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body{
"contractId": 123456789,
"status": "accepted"
}{}{}{}{}{}curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-priceimport requests
url = "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price"
response = requests.put(url)
print(response.text)const options = {method: 'PUT'};
fetch('https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price';
const options = {method: 'PUT'};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price"
req, _ := http.NewRequest("PUT", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-sync-shipping-price")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
response = http.request(request)
puts response.read_body{
"contractId": 123456789,
"status": "accepted"
}{}{}{}{}{}