How to create a subscription in 'Draft' status?

Reply
Highlighted
bolaurent Master

Master

Master
Posts: 99
Registered: ‎04-10-2016
Accepted Solution

How to create a subscription in 'Draft' status?

[ Edited ]

I need to create subscriptions, via API, in Draft Status.

 

'Status' is not a valid parameter for the REST API Create Subscription endpoint ('/v1/subscriptions'), using zuora-version 211.0.

 

 

{'reasons': [{'code': 53000021, 'message': "Invalid parameter(s): 'status'."}], 'processId': 'AB50D6EB05E0DBBF', 'success': False}

 

I tried '/v1/create/subscription', but I got following message.

 

AssertionError: POST to /action/create/ failed: b'{"message":"Error - invalid object type: subscription"}\n'  

 

bolaurent Master

Master

Master
Posts: 99
Registered: ‎04-10-2016

Re: How to create a subscription in 'Draft' status?

According to the following article (October 2016), Zuora Support Team says this is not possible with REST; the recommendation there is to use SOAP.

 

REST api to create subscription with draft status

 

grrrr.

yamasaki1ma Master

Master

Master
Posts: 41
Registered: ‎02-22-2017

Re: How to create a subscription in 'Draft' status?

Hi @bolaurent

 

This discussion continues in the article you showed, and recently (July, 2017), @vu_phan indicated that this can be achieved with REST's Subscribe call
https://community.zuora.com/t5/Subscriptions/REST-api-to-create-subscription-with-draft-status/td-p/...
In fact, I confirmed that Draft's Subscription was created in this way when this was posted .

 

(I know that Subscribe call exists from the SOAP era. What you want is just to use "Create Subscription"? If so, I can understand your thoughts very much ...!)

kevin_lussie Zuora SME

Zuora SME

Zuora SME
Posts: 6
Registered: ‎01-11-2016

Re: How to create a subscription in 'Draft' status?

[ Edited ]

Hi, 

 

Have you tried the Rest Action for Subscribe?

 

POST: https://rest.apisandbox.zuora.com/v1/action/subscribe

 

 

{
  "subscribes" : [
    {
      "Account": {
        "Id":"2c92c0f8602f9f7c016030df75050de5"
      },
      "SubscribeOptions" : {
        "GenerateInvoice": false
      },
      "SubscriptionData": {
        "Subscription": {
          "InitialTerm": "12",
          "Notes": "My Subscription Notes",
          "RenewalTerm": "12",
          "TermStartDate": "2018-06-05",
          "TermType": "TERMED",
          "IsInvoiceSeparate": "TRUE"
        },
        "RatePlanData": [
          {
            "RatePlan": {
              "ProductRatePlanId": "2c92c0f85a46888b015a490d7d2375a6"
            },
            "RatePlanChargeData" : [
              {
                "RatePlanCharge" : {
                  "ProductRatePlanChargeId" : "2c92c0f85a46888b015a490d7d4175a8"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}

Output:

 

 

[
  {
    "SubscriptionId": "2c92c0f8602f9ebb016030e68381341d",
    "SubscriptionNumber": "A12967--S00000274",
    "AccountId": "2c92c0f8602f9f7c016030df75050de5",
    "Success": true,
    "AccountNumber": "A12967-00000167"
  }
]

 

Zuora.png
bolaurent Master

Master

Master
Posts: 99
Registered: ‎04-10-2016

Re: How to create a subscription in 'Draft' status?

Hooray! This worked for me.

 

For anyone else trying to follow this, I had to remove ContractAcceptanceDate, ContractEffectiveDate, and ServiceActivationDate from the call. When these were present, the subscription was created in Active status.

 

@kevin_lussie, thank you so much for posting the whole payload of your call; it was very helpful.