Happy Business Starts Here

Highlighted
Support SME

REST API returns Error: "Invalid parameter(s): 'invoice,collect'."

Question/Problem Statement:

 

When using  'invoice' and 'collect' parameters via REST it causes error: "Invalid parameter(s): 'invoice,collect'."

 

Heres a sample:

Request> 
curl -i -k -H "apiAccessKeyId:test.test+sbxapitest@zuora.com" -H "apiSecretAccessKey:********" -H "Content-Type:application/json" -H "Accept:application/json" -d ' 
{ 
"accountKey":"A00000000", 
"contractEffectiveDate": "2016-01-05", 
"termType":"TERMED", 
"initialTerm":12, 
"initialTermPeriodType": "Month", 
"autoRenew":true, 
"renewalTerm":12, 
"renewalTermPeriodType": "Month", 
"notes":"test subscription", 
"invoice":false, 
"collect":false, 
"subscribeToRatePlans":[ 
{ 
"productRatePlanId": "*************************", 
"chargeOverrides":[ 
{"productRatePlanChargeId":"*************************", "quantity":10} 
} 
], 
"invoiceTargetDate": "2016-01-05" 
} 
' -X POST https://apisandbox-api.zuora.com/rest/v1/subscriptions

<Response> 
{ 
"success" : false, 
"processId" : "4E000000000000", 
"reasons" : [ { 
"code" : 53000021, 
"message" : "Invalid parameter(s): 'invoice,collect'." 
} ] 
}

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √

1 REPLY 1
Support SME

Re: REST API returns Error: "Invalid parameter(s): 'invoice,collect'."

Solution:

 

In order to make "Invoice and Collect functionality" work, you need to explicitly add the Zuora API version on the Header --that is Zuora-version:196.

 

Here's a sample REST API call that worked:

 

POST /rest/v1/subscriptions HTTP/1.1
Authorization:
Basic bWFyaWFnaXJsaWUubW9ucG9uQHp1b3JhLmNvbTpsdWtlYDEyMzQ1Ng==
Zuora-version:196
Host:apisandbox-api.zuora.com
Content-Length:522
X-Target-URI:https://apisandbox-api.zuora.com
Content-Type:application/json
Connection:Keep-Alive
{
"accountKey": "A00000015",
"termType": "TERMED",
"initialTerm": 12,
"autoRenew": true,
"renewalTerm": 3,
"notes": "For demo purposes.",
"subscribeToRatePlans": [
{
"productRatePlanId": "2c92c0f942c695180142dbb49b7775e8",
"chargeOverrides": [
{
"productRatePlanChargeId": "2c92c0f842c6832f0142dbb7229c2977"
}
]
}
],
"contractEffectiveDate": "2016-02-01",
"invoice": true,
"collect": false,
"invoiceTargetDate": "2016-2-20"
}


********
HTTP/1.1 200 OK
Date:
Mon, 18 Jan 2016 10:09:13 GMT
Content-Length:
247
Expires:
Mon, 18 Jan 2016 10:09:13 GMT
Connection:
keep-alive
Content-Type:
application/json;charset=utf-8
Server:
Zuora App
Pragma:
no-cache
Cache-Control:
max-age=0, no-cache, no-store

{
"success": true,
"subscriptionId": "2c92c0fb5243554e01525435b8f63995",
"subscriptionNumber": "A-S00000215",
"contractedMrr": 25,
"totalContractedValue": 300,
"invoiceId": "2c92c0fb5243554e01525435b9cd399f"
}

 

Referenced article: https://knowledgecenter.zuora.com/DC_Developers/REST_API/B_REST_API_reference/Subscriptions/02_Creat...

 






If you found my answer helpful, please give me a kudo ↑
Help others find answers faster by accepting my post as a solution √