Update a payment on an offer
API v2 is in public beta: endpoints and fields can change before general availability. See the changelog
/preorders/offers/{id}/paymentsCosts 2 rate-limit points · Rate limits
Update a deep partial of the canonical payment settings. Full and partial are stable kind selectors.
Omitted fields stay unchanged. Null clears copy or price_adjustment. Explicit options_offered adds/removes kinds. Choose full or partial for ambiguous billing copy. Read-only and unknown fields are rejected. Invalid patches write nothing locally; publication runs after commit.
Also searched asedit paymentschange payment settingsmodify billingupdate remaining balance settingschange discountset discountapply discountset percentage offset amount offclear discountremove discountno discountstop discountremove preorder discountenable auto collectenable auto chargeauto-charge balanceautomatically charge balanceturn on auto collectdisable auto collectdisable auto chargestop auto chargeturn off auto collectmanual balance collectiondisable auto collect on fulfillmentdon't charge on fulfillmentturn off charge at ship timestop collecting on shipenable auto collect on fulfillmentcharge on fulfillmentauto charge at ship timecollect balance on shipshow partial payment option firstpreselect deposit optiondefault to full paymentdisable payment optionenable payment optionadd full payment optionadd partial payment optionset payment modechange payment optionsremove full payment optionstop offering full paymentpartial payment onlydeposit onlyremove partial payment optionstop offering depositfull payment onlyoffer both payment optionslet customers choose how to payoffer both full and partial paymentset balance due dayscharge balance after n dayscollect balance days after checkoutbalance due in dayscharge remaining balance laterset days after checkoutcollect balance a week after checkoutshow payment widgetshow payment and savingsenable billing widgetshow savings breakdownshow payment schedule to customersshow payment breakdownturn on billing widgethide payment widgethide payment and savingsdisable billing widgethide savings breakdownhide payment breakdownturn off billing widgetset deposit amountset a fixed depositcharge a fixed amount upfrontset upfront payment amountchange down payment amountchange deposit amountchange down paymentset deposit percentset deposit percentageset upfront payment percentset discount textchange discount blurbset discount messagechange discount copyset savings textset option copychange billing titleset payment option textset partial option copyset deposit option textset full option copyset payment datebalance due datecharge on a specific datefinal payment datecollect balance on dateshow discounted pricedisplay sale priceshow discount pricehide discounted priceset billing widget titleset billing widget descriptionchange payment breakdown textedit billing widget copy
Path parameters
idstringRequired
Headers
Idempotency-KeystringA fresh unique key for every write (a new UUID, say); reuse it only to retry that write. Keys are remembered for 1 hour: the same key and the same request within that hour returns the first result, with
Idempotent-Replayed: true, without running again; the same key with a different method, path or body is refused (422idempotency_key_reused); a retry while the first is still running gets 409idempotency_key_in_progress. Keys are per store. Server errors and rate limits are not kept, so their retry runs.
Request body
options_offeredstringExplicitly add or remove full/partial payment kinds. Omitted kinds remain offered. Mode changes initialize payment widget and cart attributes.
One offullpartialfull_and_partialdefault_optionstringSelect an offered, synced full or partial kind as the default.
One offullpartialfullobjectShow 4 child attributesHide child attributes
option_titlestring, nullableBilling Title for full payment.
option_descriptionstring, nullableBilling Description for full payment.
discount_textstring, nullableDiscount copy for full payment.
price_adjustmentobject, nullableExample:stringShow 2 child attributesHide child attributes
adjustment_typestring, nullablePercentage or fixed amount discount. Null clears the discount.
One ofpercentagepricefixed_amountnulladjustment_amountnumber, nullableDiscount amount; an omitted type uses the saved type.
partialobjectShow 6 child attributesHide child attributes
option_titlestring, nullableBilling Title for partial payment.
option_descriptionstring, nullableBilling Description for partial payment.
discount_textstring, nullableDiscount copy for partial payment.
price_adjustmentobject, nullableExample:stringShow 2 child attributesHide child attributes
adjustment_typestring, nullablePercentage or fixed amount discount. Null clears the discount.
One ofpercentagepricefixed_amountnulladjustment_amountnumber, nullableDiscount amount; an omitted type uses the saved type.
checkout_chargeobjectShow 2 child attributesHide child attributes
charge_typestringDeposit as percentage or price.
One ofpercentagepricecharge_amountnumberCheckout deposit; percentage must not exceed 100. 0 is the editor's "No upfront payment": nothing is charged at checkout.
remaining_balanceobjectShow 3 child attributesHide child attributes
charge_triggerstringCollect at an exact time or days after checkout.
One ofexact_timetime_after_checkoutcharge_exact_timestring, nullableISO 8601 datetime, required for exact_time; otherwise null.
days_after_checkoutinteger, nullablePositive days, required for time_after_checkout; otherwise null.
collection_schedulestringCollect the remaining balance manually, on its scheduled date, or on fulfillment. A balance due date alone charges nothing: "charge the rest after N days" also needs scheduled, and while it stays manual say the merchant collects it.
One ofmanualscheduledon_fulfillmentshow_payment_widgetbooleanShow payment & discount savings. Also turns the payment cart attribute (advanced.cart_attributes.show_payment) on or off, as the editor does.
show_discounted_pricebooleanShow discounted price.
localestringLanguage the translated fields are written in, such as 'fr' or 'pt-BR'. Omitted: the shop's default language. Untranslated fields ignore it.
Errors
Missing or invalid X-Auth-Token.
The resource does not exist for this shop, or the action path is not registered.
An earlier request with the same Idempotency-Key is still running. Wait, then resend the same request with the same key.
Invalid fields: one details entry per field error, its path the canonical section path. Nothing was saved.
Rate limited: cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.
Every error has the same shape: see Errors.
curl -X PATCH "https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/payments" \
-H "X-Auth-Token: $STOQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"options_offered": "full",
"default_option": "full",
"full": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string"
},
"partial": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string",
"checkout_charge": {
"charge_type": "percentage",
"charge_amount": 0
},
"remaining_balance": {
"charge_trigger": "exact_time",
"charge_exact_time": "string",
"days_after_checkout": "string"
}
},
"collection_schedule": "manual",
"show_payment_widget": true,
"show_discounted_price": 5,
"locale": "fr"
}'const res = await fetch("https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/payments", {
method: "PATCH",
headers: {
"X-Auth-Token": process.env.STOQ_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"options_offered": "full",
"default_option": "full",
"full": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string"
},
"partial": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string",
"checkout_charge": {
"charge_type": "percentage",
"charge_amount": 0
},
"remaining_balance": {
"charge_trigger": "exact_time",
"charge_exact_time": "string",
"days_after_checkout": "string"
}
},
"collection_schedule": "manual",
"show_payment_widget": true,
"show_discounted_price": 5,
"locale": "fr"
}),
});
const data = await res.json();import os
import requests
res = requests.patch(
"https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/payments",
headers={"X-Auth-Token": os.environ["STOQ_API_KEY"]},
json={
"options_offered": "full",
"default_option": "full",
"full": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string"
},
"partial": {
"option_title": "string",
"option_description": "string",
"discount_text": "Preorder now",
"price_adjustment": "string",
"checkout_charge": {
"charge_type": "percentage",
"charge_amount": 0
},
"remaining_balance": {
"charge_trigger": "exact_time",
"charge_exact_time": "string",
"days_after_checkout": "string"
}
},
"collection_schedule": "manual",
"show_payment_widget": True,
"show_discounted_price": 5,
"locale": "fr"
},
)
data = res.json()require "net/http"
require "json"
uri = URI("https://app.stoqapp.com/api/v2/external/preorders/offers/73a74948-2b57-4cc3-971f-2b441828c977/payments")
req = Net::HTTP::Patch.new(uri, "X-Auth-Token" => ENV["STOQ_API_KEY"], "Content-Type" => "application/json")
req.body = {
options_offered: "full",
default_option: "full",
full: {
option_title: "string",
option_description: "string",
discount_text: "Preorder now",
price_adjustment: "string"
},
partial: {
option_title: "string",
option_description: "string",
discount_text: "Preorder now",
price_adjustment: "string",
checkout_charge: {
charge_type: "percentage",
charge_amount: 0
},
remaining_balance: {
charge_trigger: "exact_time",
charge_exact_time: "string",
days_after_checkout: "string"
}
},
collection_schedule: "manual",
show_payment_widget: true,
show_discounted_price: 5,
locale: "fr"
}.to_json
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(req) }
data = JSON.parse(res.body){
"errors": [
"Invalid API key"
],
"code": "auth_invalid",
"details": [
{
"code": "auth_invalid",
"message": "Invalid API key",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"Offer not found"
],
"code": "not_found",
"details": [
{
"code": "not_found",
"message": "Offer not found",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"A request with this Idempotency-Key is still running"
],
"code": "idempotency_key_in_progress",
"details": [
{
"code": "idempotency_key_in_progress",
"message": "A request with this Idempotency-Key is still running",
"path": null,
"value": null,
"expected": null
}
]
}{
"errors": [
"widget.button.text_color must be a hex color"
],
"code": "invalid_params",
"details": [
{
"code": "invalid_params",
"message": "must be a hex color",
"path": "widget.button.text_color",
"value": "blue",
"expected": {
"type": "string"
}
}
]
}{
"errors": [
"Rate limit exceeded"
],
"code": "rate_limited",
"details": [
{
"code": "rate_limited",
"message": "Rate limit exceeded",
"path": null,
"value": null,
"expected": null
}
]
}