Paycose Docs
Subscription
PATCH/subscriptions/{subscription_id}

Update Subscription

Body — UpdateSubscriptionDTO (app/handlers/v1/subscription/request.go:317). All fields optional.

FieldNotes
line_itemsreplace the subscription's items
default_payment_method_idpointer string — set to swap default PM
proration_behaviorcreate_prorations / none / always_invoice (the last fires a proration invoice synchronously)
billing_thresholdsre-arm or change {amount_gte, reset_billing_cycle_anchor}
invoice_settings{custom_fields, footer, account_tax_ids}
pending_invoice_item_interval{interval, interval_count}

Request

Example

curl -X PATCH 'https://api.paycose.com/api/v1/app1/platform/wallet/subscriptions/{{subscription_id}}' \
  -H 'X-Session-Token: {{session_token}}' \
  -H 'X-Country: {{country}}' \
  -d '{
  "line_items": [],
  "metadata": {},
  "description": "<string>",
  "collection_method": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "payment_method_providers": [
    "<string>"
  ],
  "auto_advance": false,
  "due_date": "<RFC3339 timestamp>",
  "cancel_at_period_end": false,
  "default_payment_method": {
    "id": "<string>",
    "type": "<string>"
  },
  "default_payment_method_id": "{{payment_method_id}}",
  "proration_behavior": "create_prorations",
  "billing_thresholds": null,
  "invoice_settings": null,
  "pending_invoice_item_interval": null,
  "coupon": "<string>",
  "trial_end": "<RFC3339 timestamp>",
  "trial_settings": {
    "end_behavior_missing_payment_method": "<string>"
  },
  "billing_cycle_anchor": "<RFC3339 timestamp>",
  "labels": [
    "<string>"
  ]
}'

Headers

NameValue
X-Session-Token{{session_token}}
X-Country{{country}}

Body

NameTypeValue
line_itemsarray[0]
metadataobject{…}
descriptionstring<string>
collection_methodstring<string>
payment_method_typesarray[1]
payment_method_providersarray[1]
auto_advancebooleanfalse
due_datestring<RFC3339 timestamp>
cancel_at_period_endbooleanfalse
default_payment_methodobject{…}
default_payment_method_idstring{{payment_method_id}}
proration_behaviorstringcreate_prorations
billing_thresholdsnullnull
invoice_settingsnullnull
pending_invoice_item_intervalnullnull
couponstring<string>
trial_endstring<RFC3339 timestamp>
trial_settingsobject{…}
billing_cycle_anchorstring<RFC3339 timestamp>
labelsarray[1]
{
  "line_items": [],
  "metadata": {},
  "description": "<string>",
  "collection_method": "<string>",
  "payment_method_types": [
    "<string>"
  ],
  "payment_method_providers": [
    "<string>"
  ],
  "auto_advance": false,
  "due_date": "<RFC3339 timestamp>",
  "cancel_at_period_end": false,
  "default_payment_method": {
    "id": "<string>",
    "type": "<string>"
  },
  "default_payment_method_id": "{{payment_method_id}}",
  "proration_behavior": "create_prorations",
  "billing_thresholds": null,
  "invoice_settings": null,
  "pending_invoice_item_interval": null,
  "coupon": "<string>",
  "trial_end": "<RFC3339 timestamp>",
  "trial_settings": {
    "end_behavior_missing_payment_method": "<string>"
  },
  "billing_cycle_anchor": "<RFC3339 timestamp>",
  "labels": [
    "<string>"
  ]
}

Responses

400400 Bad Request

Headers

NameValue
Content-Typeapplication/json

Body

{
  "object": "error",
  "code": "<string>",
  "key": "<string>",
  "i18n_key": "<string>",
  "message": "<string>",
  "request_id": "<string>"
}
500500 Internal Server Error

Headers

NameValue
Content-Typeapplication/json

Body

{
  "object": "error",
  "code": "<string>",
  "key": "<string>",
  "i18n_key": "<string>",
  "message": "<string>",
  "request_id": "<string>"
}

On this page