Subscription_Update
#
Description#
This function updates the details of an existing subscription.
Request Parameters#
Parameter |
Type | Description |
---|---|---|
subscription_id |
Number | The id number of the subscription to be updated |
customer_id edit_customer customer_login |
Number String String |
The customer id The customer login The customer login |
paymentcard_id |
Number | The id of the saved payment card linked to the subscription |
product_id Edit_Product Product_Code Product_SKU |
Number String String String |
ID Number of product Product code string Product code string Product SKU string |
productsubscriptionterm_id |
Number | Subscription term id for the product |
address_id |
Number | Address id for the subscription |
ship_id |
Number | Shipping id for the subscription |
ship_data |
String | The name of the shipping option for the subscription |
quantity |
Number | Product quantity for the subscription |
nextdate |
Number | Datetime string for the next subscription fulfillment date |
template_codes |
String | Template codes for product |
attribute_codes |
String | Attribute codes for product |
values |
String | Product values |
Response Parameters#
Parameter |
Type | Description |
---|---|---|
success |
Boolean | Boolean value indicating if the api request was successful |
id |
Number | The subscription id |
order_id |
Number | Order id associated with the customer subscription |
line_id |
Number | Line id of the subscription |
cust_id |
Number | Customer id for the subscription |
custpc_id |
Number | The id of the payment card linked to the subscription |
product_id |
Number | Product id for the subscription item |
subterm_id |
Number | Id number for the subscription term |
addr_id |
Number | Address id of the subscription |
ship_id |
Number | Line id of the subscription |
ship_data |
String | The name of the shipping option for the subscription |
quantity |
Number | Product quantity for the subscription |
termrem |
Number | Number of terms remaining for the subscription |
termproc |
Number | Number of terms processed on the subscription |
firstdate |
Object | Subscription first fulfillment date |
status |
String | Subscription status |
message |
String | Subscription status message |
tax |
Number | Tax for the subscription |
formatted_tax |
String | Currency formatted subscription tax |
shipping |
Number | Shipping total for the subscription |
formatted_shipping |
String | Currency formatted shipping total |
subtotal |
Number | Subscription subtotal |
formatted_subtotal |
String | Currency formatted subtotal |
total |
Number | Subscription total price |
formatted_total |
String | Currency formatted subscription total price |
authfails |
Number | Number of times payment authorization has failed |
lastafail |
Object | Time of the last failed authorization attempt |
nextdate |
Object | Time of the next authorization attempt |
cncldate |
Object | Time of the subscription authorization conclude |
options |
Object | Array of objects containing options. |
date Object#
The data structure of the firstdate
object below is repeated in lastdate
, nextdate
, cncldate
, lastafail
.
Parameter |
Type | Description |
---|---|---|
time_t |
Number | Unix timestamp |
year |
Number | Year component |
month |
Number | Month component |
day |
Number | Day component |
hour |
Number | Hour component |
minute |
Number | Minute component |
second |
Number | Second component |
timezone |
Number | Timezone offset in seconds |
options
Object#
Parameter |
Type | Description |
---|---|---|
subscrp_id |
String | Subscription ID |
templ_code |
String | Attribute Template code |
attr_code |
String | Attribute Code |
value |
String | Option value |
Example Request#
{
"Store_Code": "{{Store_Code}}",
"Miva_Request_Timestamp": "{{$timestamp}}",
"Function": "Subscription_Update",
"Subscription_ID": 2,
"Customer_ID": 2,
"PaymentCard_ID": 0,
"Product_ID": 9,
"ProductSubscriptionTerm_ID": 3,
"Address_ID": 2,
"Ship_ID": 140,
"Ship_Data": "ground",
"Quantity": 1,
"NextDate": "2022-03-11T00:00:00-00:00",
"Template_Codes": "",
"Attribute_Codes": "",
"Values": ""
}
Example Response#
{
"success": 1,
"data": {
"id": 2,
"order_id": 0,
"line_id": 0,
"cust_id": 2,
"custpc_id": 0,
"product_id": 9,
"subterm_id": 3,
"addr_id": 2,
"ship_id": 140,
"ship_data": "ground",
"quantity": 1,
"termrem": 0,
"termproc": 0,
"firstdate": {
"time_t": 0,
"year": 1969,
"month": 12,
"day": 31,
"hour": 19,
"minute": 0,
"second": 0,
"timezone": -5
},
"lastdate": {
"time_t": 0,
"year": 1969,
"month": 12,
"day": 31,
"hour": 19,
"minute": 0,
"second": 0,
"timezone": -5
},
"nextdate": {
"time_t": 1646974800,
"year": 2022,
"month": 3,
"day": 11,
"hour": 0,
"minute": 0,
"second": 0,
"timezone": -5
},
"status": "E",
"message": "Invalid payment method",
"cncldate": {
"time_t": 0,
"year": 1969,
"month": 12,
"day": 31,
"hour": 19,
"minute": 0,
"second": 0,
"timezone": -5
},
"tax": 1.75,
"formatted_tax": "$1.75",
"shipping": 10.0,
"formatted_shipping": "$10.00",
"subtotal": 18.0,
"formatted_subtotal": "$18.00",
"total": 29.75,
"formatted_total": "$29.75",
"authfails": 0,
"lastafail": {
"time_t": 0,
"year": 1969,
"month": 12,
"day": 31,
"hour": 19,
"minute": 0,
"second": 0,
"timezone": -5
},
"options": []
}
}
Error Responses#
Error Code | Error Message | Error Description |
---|---|---|
MER-SUB-JSN-00060 | Subscription not found | Subscription not found |