Subscription Custom Charges

Marvin's Avatar

Marvin

10 Jan, 2011 06:29 AM

Hi,

Im trying to pass custom amount to the API, but it seems not working, can you please tell me what's wrong with the array below?

Array
(

[code] => TEST_MONTHLY_PRO_1
[subscription] => Array
    (
        [planCode] => ANNUAL_PRO_1
        [charges] => Array
            (
                [eachAmount] => 34.33
            )

        [changeBillDate] => 2011-0101
    )

)

I want to pass a custom amount '34.33' instead of using the amount for 'TEST_MONTHLY_PRO_1' assigned from CG admin.

Thanks in advance.

  1. 1 Posted by Marvin on 10 Jan, 2011 06:30 AM

    Marvin's Avatar

    pls ignore the typo for changeBillDate value.

  2. 2 Posted by Marvin on 10 Jan, 2011 06:34 AM

    Marvin's Avatar

    'ANNUAL_PRO_1'(plan code) is what i meant instead of 'TEST_MONTHLY_PRO_1'(customer code)

  3. Support Staff 3 Posted by Marc Guyer on 11 Jan, 2011 04:23 PM

    Marc Guyer's Avatar

    Hi Marvin -- Sorry for the delay. You're missing a nested array for charges. You'll also need to include the chargeCode and quantity:

    [code] => TEST_MONTHLY_PRO_1
    [subscription] => Array
        (
            [planCode] => ANNUAL_PRO_1
            [charges] => Array
                (
                    Array
                        (
                            [chargeCode] => MY_CODE,
                            [quantity] => 1,
                            [eachAmount] => 34.33
                        )
                )
    
            [changeBillDate] => 2011-0101
        )
    
  4. 4 Posted by marvin on 12 Jan, 2011 02:56 AM

    marvin's Avatar

    Thanks so much, will try it right away...

  5. 5 Posted by marvin on 12 Jan, 2011 10:25 AM

    marvin's Avatar

    Hi,
    Still didn't work, i tried two different sets(tested one at a time). FYI im posting againts the : editCustomer:

    function editCustomer($code, $id = null, array $data) {

        $this->_requireIdentifier($code, $id);
        return new CheddarGetter_Response(
            $this->request(
                '/customers/edit/' . (($id) ? 'id/'.$id : 'code/'.urlencode($code)), 
                $data
            )
        );
    }
    

    1 - Array
    (

    [subscription] => Array
        (
            [planCode] => MONTHLY_PRO_1
            [charges] => Array
                (
                    [chargeCode] => DISCOUNTED_MONTHLY_PRO_1
                    [quantity] => 1
                    [eachAmount] => 35
                )
        )
    

    )

    2 - Array
    (

    [subscription] => Array
        (
            [planCode] => MONTHLY_PRO_1
            [charges] => Array (
    
                [0] = Array
                    (
                        [chargeCode] => DISCOUNTED_MONTHLY_PRO_1
                        [quantity] => 1
                        [eachAmount] => 35
                    )
            )
        )
    

    )

  6. Support Staff 6 Posted by Marc Guyer on 12 Jan, 2011 03:25 PM

    Marc Guyer's Avatar

    Ahh, I assumed you were creating a new customer. The new customer call is the only one where you can provide charges inline. Here's the raw docs on the edit customer call:

    https://cheddargetter.com/developers#update-customer-subscription

    If you'd like to add a charge to an existing customer's account, just use the add charge call. Here are the raw docs on that:

    https://cheddargetter.com/developers#add-charge

    Since you appear to be using the official PHP wrapper, you can use CheddarGetter_Client::addCharge()

  7. Dean closed this discussion on 16 Jan, 2013 04:02 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