V2
This topic shows information relevant specifically for Subscribe REST API version 20210401 referred to as V2 Discount Tickets are wrappers for campaign codes,which provide a discount as defined in a Campaign. They allow you to offer multiple campaign discounts simultaneously as an array to Subscriptions and to manage the application of these discounts. Use this call to apply a single Discount Ticket to an existing subscription. The Discount Ticket can be applied to all the subscription items or to specific ones. For more details, see Discount Tickets.HTTP Request
POST https://api.vindicia.com/subscriptions/:subscription/actions/add_discount_ticket
Route (URL) Parameters
| Parameter | Default | Description | Required |
|---|---|---|---|
| subscription | n/a | The id or the vid of the Subscription to which to apply the discount. | Yes |
Query Parameters
| Parameter | Type | Default | Description | Required |
|---|---|---|---|---|
| subscription_item | string | n/a | The id or the vid of the subscription item to which to apply the disccount ticket.Note: When applying the Discount Ticket to a subscription item, specify the product or the subscription item as a query parameter not both. | No |
| product | string | n/a | The product associated with the Subscription Item to which to apply the Discount Ticket.Note: When applying the Discount Ticket to a subscription item, specify the product or the subscription item as a query parameter not both. | No |
| apply_discount_to | enum | n/a | Defines to which of the objects the Discount Ticket is applied. Select from:- SubscriptionItem: Apply to specified Item - BillingPlan: Apply to the subscription’s billing plan - Distributed: Applied to any of the Subscription’s objects to which applicable. | Yes |
| dryrun | boolean | false | Boolean flag, if set to true, will return a quote of the updated subscription, without recording the result in the Subscribe database. | No |
| conjunction_resolution | enum | Add | Defines how to resolve instances where the addition of a DiscountTicket results in multiple DiscountTickets being applied to the same object.Select from: - Replace: Replaces the existing Discount Ticket with the new one. - Insert: Inserts the new Discount Ticket in front of the existing Discount Ticket. - Add: Adds the new Discount Ticket in parallel with the existing Discount Ticket. | No |
Accepts
A Discount Ticket object.Returns
JSON - A full Subscription object.Example Request
In this example, we are adding a discount ticket to any of the subscription’s objects to which its applicable (based on the campaign’s definitions). In the result we show that was applicable to a subscription Item and the billing plan.
curl -X POST \
-u acaff38d462f9430d5cbcbaf:a575771fc679b9de \
-d ' {
"object": "DiscountTicket",
"id": "stab1_HOLc_uPe-xfJI7G3YAOzNJYidy0",
"campaign_code": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_modify_campaign_2021-08-16"
}
'"https://api.staging.us-west.vindicia.com/subscriptions/sub_add_distrib_discos_U1jwG8GK0d3HIb0H8eZJTnTWk8Y/actions/add_discount_ticket?conjunction_resolution=Add&apply_discount_to=Distributed"
Example Response
The above command returns JSON structured like this:{
"object": "Subscription",
"id": "sub_add_distrib_discos_U1jwG8GK0d3HIb0H8eZJTnTWk8Y",
"vid": "b733b4680bcdfab038564e0796af54f64c9a38c1",
"created": "2021-08-16T10:29:20-07:00",
"account": {
"object": "Account",
"id": "bh_Qz1PNk14H9BAqul6GkmkZpVk",
"vid": "4a2064f9b75ccb68a80afa95c3418de1a0f7ce94",
"created": "2021-08-16T10:28:53-07:00",
"email": "null@vindicia.com",
"email_type": "html",
"company": "Lorem Ipsum Inc",
"name": "Forest Chump",
"shipping_address": {
"object": "Address",
"vid": "2d867e434e1ba8f6f5929e98db52eaf3d045f14e",
"name": "Test",
"line1": "11235 Fibonacci St.",
"city": "San Mateo",
"district": "CA",
"postal_code": "94403",
"country": "US",
"phone": "(650) 555-1212x42"
},
"payment_methods": {
"object": "List",
"data": [
{
"object": "PaymentMethod",
"id": "pm1_vi_ENAWsUK4ANy0uk6D_24O2FN05Rw",
"vid": "64828ef347915a61ae9ac14dc617c78281182344",
"created": "2021-08-16T10:28:54-07:00",
"type": "CreditCard",
"credit_card": {
"object": "CreditCard",
"vid": "f375f20ad78940e103035d6d6cb60155996ad807",
"account": "422232XXXXXX8611",
"bin": "422232",
"last_digits": "8611",
"account_length": 16,
"expiration_date": "202308",
"last_au_request_date": null,
"last_update_date": null
},
"account_holder": "pm1_Forest Chump",
"billing_address": {
"object": "Address",
"vid": "271e21b79ca08a5e4ed597f9e6d5d51433dbcd20",
"name": "Test",
"line1": "11235 Fibonacci St.",
"city": "San Mateo",
"district": "CA",
"postal_code": "94403",
"country": "US",
"phone": "(650) 555-1212x42"
},
"customer_specified_type": "pm1_VI",
"primary": true,
"active": true
}
],
"total_count": 1
}
},
"billing_plan": {
"object": "BillingPlan",
"id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"vid": "bd7f8cab7882adec05b9bbc1edd2e962ac1c0bbc",
"created": "2021-08-16T10:28:56-07:00",
"description": "product default plan _trwGb7zhZ8wO7h4Vm9",
"status": "Active",
"tax_classification": "TaxExempt",
"br_tax_category": "Services",
"periods": {
"object": "List",
"data": [
{
"object": "BillingPlanPeriod",
"type": "Day",
"quantity": 20,
"cycles": 0,
"prices": {
"object": "List",
"data": [
{
"object": "BillingPlanPrice",
"amount": 20,
"currency": "USD"
}
],
"total_count": 1
},
"do_not_notify_first_bill": false
}
],
"total_count": 1
},
"skip_initial_billing_notification": false,
"metadata": {
"plan name": "implicit billing plan"
},
"entitlements": {
"object": "List",
"data": [
{
"object": "Entitlement",
"id": "ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"description": "Description for ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20"
}
],
"total_count": 1
},
"times_to_run": "1",
"used_on_subscriptions": true
},
"payment_method": {
"object": "PaymentMethod",
"id": "pm1_vi_ENAWsUK4ANy0uk6D_24O2FN05Rw",
"vid": "64828ef347915a61ae9ac14dc617c78281182344",
"created": "2021-08-16T10:28:54-07:00",
"type": "CreditCard",
"credit_card": {
"object": "CreditCard",
"vid": "f375f20ad78940e103035d6d6cb60155996ad807",
"account": "422232XXXXXX8611",
"bin": "422232",
"last_digits": "8611",
"account_length": 16,
"expiration_date": "202308",
"last_au_request_date": null,
"last_update_date": null
},
"account_holder": "pm1_Forest Chump",
"billing_address": {
"object": "Address",
"vid": "271e21b79ca08a5e4ed597f9e6d5d51433dbcd20",
"name": "Test",
"line1": "11235 Fibonacci St.",
"city": "San Mateo",
"district": "CA",
"postal_code": "94403",
"country": "US",
"phone": "(650) 555-1212x42"
},
"customer_specified_type": "pm1_VI",
"primary": true,
"active": true
},
"currency": "USD",
"description": "sub_add_distrib_discos_U1jwG8GK0d3HIb0H8eZJTnTWk8Y",
"status": "Active",
"billing_state": "Good Standing",
"starts": "2021-08-06T00:00:00-07:00",
"ends": "2021-08-26T00:00:00-07:00",
"entitled_through": "2021-08-26T00:00:00-07:00",
"items": {
"object": "List",
"data": [
{
"object": "SubscriptionItem",
"id": "sub_item_Gl_SNy3wb_-Vt9DTQv75lROg96g",
"vid": "3666976cf9dc5d259fd8c68f0801e2f4946d82ac",
"index": 0,
"product": {
"object": "Product",
"id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p1",
"vid": "cf40687620af816dc5c0415e79ed247e436a45cc",
"created": "2021-08-16T10:29:01-07:00",
"descriptions": {
"object": "List",
"data": [
{
"object": "ProductDescription",
"language": "EN",
"description": "Test Product Description"
}
],
"total_count": 1
},
"status": "Active",
"tax_classification": "TaxExempt",
"br_tax_category": "Services",
"default_billing_plan": {
"object": "BillingPlan",
"id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"vid": "bd7f8cab7882adec05b9bbc1edd2e962ac1c0bbc",
"created": "2021-08-16T10:28:56-07:00",
"description": "product default plan _trwGb7zhZ8wO7h4Vm9",
"status": "Active",
"tax_classification": "TaxExempt",
"br_tax_category": "Services",
"periods": {
"object": "List",
"data": [
{
"object": "BillingPlanPeriod",
"type": "Day",
"quantity": 20,
"cycles": 0,
"prices": {
"object": "List",
"data": [
{
"object": "BillingPlanPrice",
"amount": 20,
"currency": "USD"
}
],
"total_count": 1
},
"do_not_notify_first_bill": false
}
],
"total_count": 1
},
"skip_initial_billing_notification": false,
"metadata": {
"plan name": "implicit billing plan"
},
"entitlements": {
"object": "List",
"data": [
{
"object": "Entitlement",
"id": "ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"description": "Description for ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20"
}
],
"total_count": 1
},
"times_to_run": "1",
"used_on_subscriptions": true
},
"entitlements": {
"object": "List",
"data": [
{
"object": "Entitlement",
"id": "ent for prod.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p1",
"description": "Description for ent for prod.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p1"
}
],
"total_count": 1
},
"prices": {
"object": "List",
"data": [
{
"object": "ProductPrice",
"amount": 20,
"currency": "USD"
}
],
"total_count": 1
}
},
"quantity": 1,
"created": "2021-08-06T00:00:00-07:00",
"starts": "2021-08-06T00:00:00-07:00",
"discount_tickets": {
"object": "List",
"data": [
{
"object": "DiscountTicket",
"id": "stab1_HOLc_uPe-xfJI7G3YAOzNJYidy0",
"vid": "f0dadeb1aaa15e29785fe980e8e72f8c2554e858",
"state": "Redeemed",
"added_date": "2021-08-16T10:30:39-07:00",
"start_billing_sequence": 1,
"campaign_id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_campaign"
}
],
"total_count": 1
}
},
{
"object": "SubscriptionItem",
"id": "sub_item_yuvELCKQVo4aL9G6b4ErfD-iuDE",
"vid": "c3752bde85bb81586fe295c5b846e1af7e26564d",
"index": 1,
"product": {
"object": "Product",
"id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p3",
"vid": "ca0e9e7483c83930101db84811255ee9f0ad75bc",
"created": "2021-08-16T10:29:06-07:00",
"descriptions": {
"object": "List",
"data": [
{
"object": "ProductDescription",
"language": "EN",
"description": "Test Product Description"
}
],
"total_count": 1
},
"status": "Active",
"tax_classification": "TaxExempt",
"br_tax_category": "Services",
"default_billing_plan": {
"object": "BillingPlan",
"id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"vid": "bd7f8cab7882adec05b9bbc1edd2e962ac1c0bbc",
"created": "2021-08-16T10:28:56-07:00",
"description": "product default plan _trwGb7zhZ8wO7h4Vm9",
"status": "Active",
"tax_classification": "TaxExempt",
"br_tax_category": "Services",
"periods": {
"object": "List",
"data": [
{
"object": "BillingPlanPeriod",
"type": "Day",
"quantity": 20,
"cycles": 0,
"prices": {
"object": "List",
"data": [
{
"object": "BillingPlanPrice",
"amount": 20,
"currency": "USD"
}
],
"total_count": 1
},
"do_not_notify_first_bill": false
}
],
"total_count": 1
},
"skip_initial_billing_notification": false,
"metadata": {
"plan name": "implicit billing plan"
},
"entitlements": {
"object": "List",
"data": [
{
"object": "Entitlement",
"id": "ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20",
"description": "Description for ent for bp.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_day20"
}
],
"total_count": 1
},
"times_to_run": "1",
"used_on_subscriptions": true
},
"entitlements": {
"object": "List",
"data": [
{
"object": "Entitlement",
"id": "ent for prod.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p3",
"description": "Description for ent for prod.id=sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p3"
}
],
"total_count": 1
},
"prices": {
"object": "List",
"data": [
{
"object": "ProductPrice",
"amount": 20,
"currency": "USD"
}
],
"total_count": 1
}
},
"quantity": 1,
"created": "2021-08-06T00:00:00-07:00",
"starts": "2021-08-06T00:00:00-07:00",
"discount_tickets": {
"object": "List",
"data": [],
"total_count": 0
}
}
],
"total_count": 2
},
"billing_day": 26,
"minimum_commitment": 3,
"notify_on_transition": false,
"next_billing": {
"object": "Transaction",
"created": "2021-08-26T00:00:00-07:00",
"amount": 56,
"currency": "USD",
"items": {
"object": "List",
"data": [
{
"object": "TransactionItem",
"sku": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_p1",
"item_type": "Purchase",
"name": "Test Product Description",
"price": 56,
"quantity": 1,
"tax_classification": "TaxExempt",
"tax_type": "Exclusive Sales",
"item_refunds": {
"object": "List",
"data": [],
"total_count": 0
},
"subtotal": 56,
"total": 56
}
],
"total_count": 1
},
"subscription_sequence": 2
},
"balance": 0,
"billing_plan_discount_tickets": {
"object": "List",
"data": [
{
"object": "DiscountTicket",
"id": "stab1_HOLc_uPe-xfJI7G3YAOzNJYidy0",
"vid": "a653fa3a1ba153ae5a57a865d2a09a0f9f124d84",
"state": "Redeemed",
"added_date": "2021-08-16T10:30:39-07:00",
"start_billing_sequence": 1,
"campaign_id": "sadtdst_d2_RXX1h6g9ImLi6SKKRE4VkeaI46A_campaign"
}
],
"total_count": 1
}
}

