Checking if a customer is currently valid or not?

Dustin Moore's Avatar

Dustin Moore

03 Nov, 2010 04:41 PM

Hi,

When using the api, looking up a customer the api returns a ton of information, including subscriptions, whether the subscription is active or not etc.

What I need to know, is how to easily check if the customer is active or not. i.e. what if a reoccurring payment was declined that month. I need to be able to disable the client.

How can I easily validate a customer's status?

  1. Support Staff 1 Posted by Marc Guyer on 04 Nov, 2010 02:27 PM

    Marc Guyer's Avatar

    Hi Dustin! --

    First of all, the 'canceledDatetime' value, if set, indicates that the customer's subscription has been canceled. CG auto-cancels a subscription for you if the customer's credit card has expired or if they have otherwise failed to pay an invoice after a few attempts.

    You may choose to cancel a subscription via the API at any time. It sounds like you want to cancel a subscription for any declined payment. In that case, you might consider using the transaction post feature to be notified when a payment occurs. You may then determine if the payment was declined and act accordingly. Settings for the transaction post feature are here:

    https://cheddargetter.com/admin/configuration/settings

  2. 2 Posted by Dustin Moore on 08 Nov, 2010 03:58 PM

    Dustin Moore's Avatar

    Thanks Marc,

    canceledDatetime is buried pretty deep in the hash, which is ok, but it would be nice if there was a top-level value for the customer that indicated whether there was a problem with billing or not.

    I appreciate the transaction post feature, and will look into that as a way to make sure transactions are validated.

    Thanks!

    Dustin

  3. Support Staff 3 Posted by Marc Guyer on 08 Nov, 2010 11:09 PM

    Marc Guyer's Avatar

    it would be nice if there was a top-level value for the customer that indicated whether there was a problem with billing or not.

    This is fairly straightforward... The PHP wrapper does it pretty well with the getCustomerLastTransaction method. What programming language/wrapper are you using?

    ...but it sounds complicated... Get the second-to-most-recent invoice. If the invoice has a paidTransactionId, it is successfully paid, otherwise it's outstanding. If outstanding, get the most recent transaction from that invoice. The status of the transaction determines the status of the invoice (it's probably response=declined).

  4. Dean closed this discussion on 16 Jan, 2013 02:59 PM.

Comments are currently closed for this discussion. You can start a new one.

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