Auto Charge Settings on Payplan (Credit Card ID)

I’m looking for a value with the API and can’t find it. When you click on “Edit Payment Plan” on an order you get a popup dialog where you can edit which credit card is to be used for Auto Charge:


When using the API Invoice Service > chargeInvoice, a Credit Card ID is required. In the API tables I can find Credit Card IDs for a Contact, Credit Card IDs for Payments they have made on any invoice, Credit Card IDs for any Subscriptions they have, but I can’t find the Credit Card ID that is assigned to a Payplan. Without that, I can’t pick the right credit card to use for chargeInvoice.

The closest thing I could do is charge a credit card that was previously charged on the same invoice, (assuming a previous payment was made), but that is not necessarily the currently selected card that the Payplan is set to Auto Charge (as shown in the dialog above).

Am I missing or something or is this information missing from the API?

Hey @Josh, I am not sure that I understand 100% but it looks like you are trying to get the current selected credit card id from a payplan out of the User Interface?
Is there a reason that you cannot use the credit card id associated to the original order or last invoice?

Are all of the cards associated with a contact active and valid? - You may be able to use the “InvoiceService.validateCreditCard” to ignore cards that are expired or no longer valid.

A potential solution would be to query the CCharge table for the last payment on an invoice and use the most recent successful card as you mentioned above. There is also the CreditCard table that you might be able to leverage in a query to select the correct card.

1 Like

Thanks @Carlos_Ochoa. I’m aware of those options, but none of them tell me which card is currently assigned to the payplan for the order I’m looking at. So, if I’m going to use the Invoice Service > chargeInvoice method, I won’t be able to charge the correct card whenever there is more than one option. The closest I can come is to charge their most recently used card, but there is no guaranty that is the card assigned for auto charge on that payplan.

Another need to know which card is assigned to a payplan is to identify individual payplans that have expired or expiring cards assigned to them. The closest I can come to this now is using billing automation to tag people who have expiring cards, but that doesn’t tell me anything about which cards are used on which payplans.

Not a problem :slight_smile: I wish I had a better suggestion for a way to get this information. As far as getting the card expiration date, you should be able to query on the CreditCard table to get the credit card expiration month and year. You may also be able to leverage the “InvoicePayment” table to look at the “PayStatus” to get the failed payments.

I have submitted a ticket to our product manager for the retrieval of the selected card on a payplan to be added in the REST API.

Thank you. Please keep me posted if that is possible. I would like to eliminate anywhere in my scripts that I know I’m making potentially bad assumptions. For now I will have to use the card of the most recent charge on the invoice in question, which SHOULD be the card that is still set as the one to auto charge on the payplan in most cases.