curl --request POST \
--url https://api.your-domain.com/example/zaymo/customer-portal/swap-product \
--header 'Content-Type: application/json' \
--header 'X-Zaymo-API-Key: <api-key>' \
--data '
{
"email": "jsmith@example.com",
"current_item_id": "<string>",
"new_product_id": "<string>"
}
'import requests
url = "https://api.your-domain.com/example/zaymo/customer-portal/swap-product"
payload = {
"email": "jsmith@example.com",
"current_item_id": "<string>",
"new_product_id": "<string>"
}
headers = {
"X-Zaymo-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Zaymo-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
current_item_id: '<string>',
new_product_id: '<string>'
})
};
fetch('https://api.your-domain.com/example/zaymo/customer-portal/swap-product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}Swap Subscription Product
Swap one of the customer’s current subscription items to a new product. The current item should come from GET /zaymo/customer-portal/subscription -> items[].id, and the new product should come from GET /zaymo/upsells/products. An optional discount code may be applied during the swap.
curl --request POST \
--url https://api.your-domain.com/example/zaymo/customer-portal/swap-product \
--header 'Content-Type: application/json' \
--header 'X-Zaymo-API-Key: <api-key>' \
--data '
{
"email": "jsmith@example.com",
"current_item_id": "<string>",
"new_product_id": "<string>"
}
'import requests
url = "https://api.your-domain.com/example/zaymo/customer-portal/swap-product"
payload = {
"email": "jsmith@example.com",
"current_item_id": "<string>",
"new_product_id": "<string>"
}
headers = {
"X-Zaymo-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-Zaymo-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
email: 'jsmith@example.com',
current_item_id: '<string>',
new_product_id: '<string>'
})
};
fetch('https://api.your-domain.com/example/zaymo/customer-portal/swap-product', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"success": true
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"success": false,
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
Zaymo will authenticate requests using the API key you provide
Body
Customer information and swap details for changing a current subscription item to a new product
The email address of the customer
The unique identifier of the customer's current subscription item, from GET /zaymo/customer-portal/subscription -> items[].id
The unique identifier for the product to swap to, from GET /zaymo/upsells/products
Optional discount code to apply to the swapped product or subscription
Response
Subscription item successfully swapped
Indicates if the request was successful
true
Was this page helpful?