400-: A pricing plan is required
Hi,
I'm creating a customer using API with the provided structure in the docs, even hardcoding (test) the planCode
and it keeps throwing the exception 400-: A pricing plan is required
.
$data = array(
'code' => 'MY_CUSTOMER_CODE',
'firstName' => 'Example',
'lastName' => 'Customer',
'email' => '[email blocked]',
'subscription' => array(
'planCode' => 'FREE'
)
);
$customer = $client->newCustomer($data);
The plan is free and the code is INTRO
On another note, can't the customer code be auto generated? (Not providing it for auto generation).
Any ideas on this?
Thanks
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Meghan Turner on 05 Jul, 2017 04:01 PM
Hi Felipe,
I think you're getting this error because you don't have a pricing plan that has the code you attempted to pass in. In the example you provided, it shows that you attempted to pass in the plan code 'FREE', but, unless you've changed your pricing plan configuration recently, you don't have a pricing plan that has the code 'FREE'. In this case, I believe you'll want to pass in the
planCode
INTRO
and you shouldn't get this error. You can find the plan codes for all of the pricing plans you've created here.On your question about auto-generating the customer code, if you're using the API you'll need to generate your own customer code. This is done intentionally to simplify the integration process by allowing you to use any existing customer codes you have in place. You can read more about our logic on custom codes here.
Hope that helps, Felipe, but let me know if I can answer any other questions for you!
Meghan
2 Posted by Felipe Aldrete on 05 Jul, 2017 04:08 PM
Hi Meghan,
The code is just an example from the docs, the data is being filled with the right info and it's not working.
IMHO would be better to leave it optional. Auto or custom.
Thanks
Support Staff 3 Posted by Meghan Turner on 05 Jul, 2017 04:12 PM
Ok, thanks for the additional info Felipe. We'll keep looking into this, but in the meantime, would you mind sending me an example of what you're passing into Cheddar when you get that error?
Meghan
4 Posted by Felipe Aldrete on 05 Jul, 2017 04:33 PM
Sure
Obviously this is just a part of a bigger process and the variables have the right values. Regarding the
planCode
we have tried hardcoding it for test purposes to no vail.Support Staff 5 Posted by Meghan Turner on 05 Jul, 2017 08:59 PM
Hi Felipe,
I had our dev team check our logs on this and they found that the word
subscription
was spelled incorrectly in the call you're making to Cheddar (your call has it spelled suscription instead of subscription). If you fix that, you should be able to make the call without a problem, but let me know if you continue to encounter issues!Meghan
6 Posted by Felipe Aldrete on 05 Jul, 2017 11:12 PM
OMG, what a boring life would be for us developers without those dumb mistakes ;)
Thanks Meghan!
Felipe Aldrete closed this discussion on 05 Jul, 2017 11:22 PM.