Update subscription contract order note
curl --request PUT \
--url https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}import requests
url = "https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}"
response = requests.put(url)
print(response.text)const options = {method: 'PUT'};
fetch('https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}';
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}",
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}"
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}")
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{
"shop": "<string>",
"activatedOn": "2023-11-07T05:31:56Z",
"allowDeliveryAddressOverride": true,
"allowDeliveryPriceOverride": true,
"autoCharge": true,
"billingCountryCode": "<string>",
"billingDateAfterTrial": "2023-11-07T05:31:56Z",
"billingPolicyInterval": "<string>",
"billingPolicyIntervalCount": 123,
"cancellationFeedback": "<string>",
"cancellationNote": "<string>",
"cancelledOn": "2023-11-07T05:31:56Z",
"contractAmount": 123,
"contractAmountUSD": 123,
"contractDetailsJSON": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currencyCode": "<string>",
"customerEmail": "<string>",
"customerFirstName": "<string>",
"customerId": 123,
"customerLastName": "<string>",
"customerName": "<string>",
"customerTag": "<string>",
"deletedVariantIds": "<string>",
"deliveryCountryCode": "<string>",
"deliveryPolicyInterval": "<string>",
"deliveryPolicyIntervalCount": 123,
"disableFixEmptyQueue": true,
"emailBouncedOrFailed": true,
"endsAt": "2023-11-07T05:31:56Z",
"graphCustomerId": "<string>",
"graphOrderId": "<string>",
"graphSubscriptionContractId": "<string>",
"id": 123,
"importedId": "<string>",
"lastSuccessfulOrder": "<string>",
"lifetimeValue": 123,
"lifetimeValueUSD": 123,
"maxCycles": 123,
"minCycles": 123,
"nextBillingDate": "2023-11-07T05:31:56Z",
"nextPaidBillingDate": "2023-11-07T05:31:56Z",
"orderAmount": 123,
"orderAmountContractCurrency": 123,
"orderAmountShopCurrency": 123,
"orderAmountUSD": 123,
"orderId": 123,
"orderName": "<string>",
"orderNote": "<string>",
"orderNoteAttributes": "<string>",
"originType": "STORE_FRONT",
"originalContractId": 123,
"pauseDurationCycle": 123,
"pauseFeedback": "<string>",
"pauseReason": "<string>",
"pauseTillDate": "2023-11-07T05:31:56Z",
"pausedFromActive": true,
"pausedOn": "2023-11-07T05:31:56Z",
"pendingCancellationCycle": 123,
"pendingCancellationDate": "2023-11-07T05:31:56Z",
"phone": "<string>",
"queueUpdatedAt": "2023-11-07T05:31:56Z",
"skipPaymentCreateUnpaidOrder": true,
"startsAt": "2023-11-07T05:31:56Z",
"status": "<string>",
"stopUpComingOrderEmail": true,
"subscriptionContractId": 123,
"subscriptionCreatedEmailSent": true,
"subscriptionCreatedEmailSentStatus": "SENT",
"subscriptionCreatedSmsSentStatus": "SENT",
"subscriptionType": "REGULAR_SUBSCRIPTION",
"subscriptionTypeIdentifier": "<string>",
"totalSuccessfulOrders": 123,
"upcomingEmailBufferDays": 123,
"upcomingEmailTaskUrl": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatingQueue": true
}Response
OK
What the contract bills per renewal now, in currencyCode: the sum of its lines' discountedPrice in contractDetailsJSON (each line's price times quantity, after discounts). Shipping and tax are not included. On a prepaid contract, one renewal pays for every delivery until the next renewal. Appstle recalculates it when the contract is updated, so changes to lines, quantities and prices show up here. It is a floating-point number and can read like 84.60000000000001: round it to the currency's decimals before you show or compare it. For the checkout order, see orderAmount.
The contract's lines as a JSON string, not an array: parse it before you read it. Each line has productId, variantId, title, variantTitle, sku, quantity, lineId, sellingPlanId and sellingPlanName (empty strings when the line has no selling plan), discountAllocations (the IDs of the discounts on the line), and three prices sent as strings: currentPrice (one unit, per renewal, after the plan's discount; on a prepaid contract it covers every delivery the renewal pays for), discountedPrice (the line total: currentPrice times quantity, after manual and code discounts) and basePrice (one unit before the plan's discount, from pricingPolicy; on a line without pricingPolicy, currentPrice divided by the number of deliveries per renewal). A line can also have pricingPolicy (the plan's discount by cycle) and customAttributes.
This subscription's share of the order the customer placed at checkout: its lines' prices after discounts, times quantity, plus their tax when the store's prices don't include tax. Shipping and the order's other items are not included, so each subscription created by one order has its own orderAmount. It is in the store's currency, which can differ from currencyCode, and it is null when the contract has no checkout order (orderName is UNKNOWN). For what the contract bills per renewal now, use contractAmount.
curl --request PUT \
--url https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}import requests
url = "https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}"
response = requests.put(url)
print(response.text)const options = {method: 'PUT'};
fetch('https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}';
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}",
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}"
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://www.myshop.com/apps/subscriptions/cp/api/update-contract-order-note/{contractId}")
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{
"shop": "<string>",
"activatedOn": "2023-11-07T05:31:56Z",
"allowDeliveryAddressOverride": true,
"allowDeliveryPriceOverride": true,
"autoCharge": true,
"billingCountryCode": "<string>",
"billingDateAfterTrial": "2023-11-07T05:31:56Z",
"billingPolicyInterval": "<string>",
"billingPolicyIntervalCount": 123,
"cancellationFeedback": "<string>",
"cancellationNote": "<string>",
"cancelledOn": "2023-11-07T05:31:56Z",
"contractAmount": 123,
"contractAmountUSD": 123,
"contractDetailsJSON": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currencyCode": "<string>",
"customerEmail": "<string>",
"customerFirstName": "<string>",
"customerId": 123,
"customerLastName": "<string>",
"customerName": "<string>",
"customerTag": "<string>",
"deletedVariantIds": "<string>",
"deliveryCountryCode": "<string>",
"deliveryPolicyInterval": "<string>",
"deliveryPolicyIntervalCount": 123,
"disableFixEmptyQueue": true,
"emailBouncedOrFailed": true,
"endsAt": "2023-11-07T05:31:56Z",
"graphCustomerId": "<string>",
"graphOrderId": "<string>",
"graphSubscriptionContractId": "<string>",
"id": 123,
"importedId": "<string>",
"lastSuccessfulOrder": "<string>",
"lifetimeValue": 123,
"lifetimeValueUSD": 123,
"maxCycles": 123,
"minCycles": 123,
"nextBillingDate": "2023-11-07T05:31:56Z",
"nextPaidBillingDate": "2023-11-07T05:31:56Z",
"orderAmount": 123,
"orderAmountContractCurrency": 123,
"orderAmountShopCurrency": 123,
"orderAmountUSD": 123,
"orderId": 123,
"orderName": "<string>",
"orderNote": "<string>",
"orderNoteAttributes": "<string>",
"originType": "STORE_FRONT",
"originalContractId": 123,
"pauseDurationCycle": 123,
"pauseFeedback": "<string>",
"pauseReason": "<string>",
"pauseTillDate": "2023-11-07T05:31:56Z",
"pausedFromActive": true,
"pausedOn": "2023-11-07T05:31:56Z",
"pendingCancellationCycle": 123,
"pendingCancellationDate": "2023-11-07T05:31:56Z",
"phone": "<string>",
"queueUpdatedAt": "2023-11-07T05:31:56Z",
"skipPaymentCreateUnpaidOrder": true,
"startsAt": "2023-11-07T05:31:56Z",
"status": "<string>",
"stopUpComingOrderEmail": true,
"subscriptionContractId": 123,
"subscriptionCreatedEmailSent": true,
"subscriptionCreatedEmailSentStatus": "SENT",
"subscriptionCreatedSmsSentStatus": "SENT",
"subscriptionType": "REGULAR_SUBSCRIPTION",
"subscriptionTypeIdentifier": "<string>",
"totalSuccessfulOrders": 123,
"upcomingEmailBufferDays": 123,
"upcomingEmailTaskUrl": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"updatingQueue": true
}