400-: A pricing plan is required

Felipe Aldrete's Avatar

Felipe Aldrete

04 Jul, 2017 12:42 AM

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

  1. Support Staff 1 Posted by Meghan Turner on 05 Jul, 2017 04:01 PM

    Meghan Turner's Avatar

    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. 2 Posted by Felipe Aldrete on 05 Jul, 2017 04:08 PM

    Felipe Aldrete's Avatar

    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.

    On your question about auto-generating the customer code, if you're using the API you'll need to generate your own customer code.

    IMHO would be better to leave it optional. Auto or custom.

    Thanks

  3. Support Staff 3 Posted by Meghan Turner on 05 Jul, 2017 04:12 PM

    Meghan Turner's Avatar

    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. 4 Posted by Felipe Aldrete on 05 Jul, 2017 04:33 PM

    Felipe Aldrete's Avatar

    Sure

             $cheddar_data = array(
                    'code' => 'TF'.$next_id,
                    'firstName' => ucwords(mb_strtolower($this->input->post('usu_nombre'), 'UTF-8')),
                    'lastName' => ucwords(mb_strtolower($this->input->post('usu_apellido'), 'UTF-8')),
                    'email' => $this->input->post('usu_email'),
                    'suscription' => array(
                        'planCode' => $plan_code
                    )
                );
    

    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.

  5. Support Staff 5 Posted by Meghan Turner on 05 Jul, 2017 08:59 PM

    Meghan Turner's Avatar

    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. 6 Posted by Felipe Aldrete on 05 Jul, 2017 11:12 PM

    Felipe Aldrete's Avatar

    OMG, what a boring life would be for us developers without those dumb mistakes ;)

    Thanks Meghan!

  7. Felipe Aldrete closed this discussion on 05 Jul, 2017 11:22 PM.

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

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM