Change Card for Payment Plan

I’d like to be able to enable a customer to change which card will be billed for a payment plan.

I’m not seeing anywhere in the table schema where the credit card is associated to the payment plan, or the job, or the invoice.

Use case – this is a payment plan, NOT a subscription.

Let’s say it’s to pay some amount over 6 payments, each 1 month apart.

After the first month, the customer has some new credit card and wishes to use this new card ( totally new card, not same number, new exp date).

Let’s say we add this new card via api - I’m assuming we’d get back the card ID - or possibly let’s say the user is presented with a drop down list showing current cards (cart type, last 4 digits) - and we get the ID of whatever card is selected.

Can I then take an Order, find the PaymentPlan that belongs to that order, and change the credit card that will be auto-charged for the next -> nth payment?

I am pretty sure you can’t do this via the API. PayPlan records are read only. The only think I can think of is creating a new payplan with the new card and try adding it to the invoice. I am not 100% how that will work though. So you would need to do some testing.

Bradb - if I could delete the payplan - I don’t see where I could then create a new one associated to the existing invoice… the work-around would be not worth doing I think -

basically store what payments are left, then change the amount due/owed to 0 out that invoice… then make a new invoice with the new card, etc… possible but I think we’ll just have a human notified that someone wants to change their card.

Thanks for your reply/for the idea though!

I would need to dig through the code and see what actually would happen and do some testing, but https://developer.infusionsoft.com/docs/xml-rpc/#invoice-create-a-custom-recurring-payment I am pretty sure it would replace the existing payment plan. Not 100% though that is would not try and charge for both payment plans though. That is the testing that would need to be done.

CC’s are NOT associated with payment plans, invoices or jobs, they are associated with PAYMENTS. That is where you find the CC id associated with the payment (in the payment table). You then back track to the CreditCard table for available details about the card (only the details that are PCI DSS compliant of course). The payment record will have the invoice id that it was made against as well. So all three are associated in the payment table (which doubles as a pivot table for invoice, credit card and payments).

John_Borelli:

Thanks for the clarification…though I don’t see any way to use the Payments, or even Invoice Payment tables to change what card will be charged for a future Payment Plan payment.

All the available data in those tables is read only…and anyway would seem to be a record of payments made - where I’m trying to change out what card will be used on the next payment…

In the UI - this is changed out in the Payment Plan…

That was a long way around explaining that you can’t. Payment Plans are created at the time the invoice is created and they are not editable from that point moving forward.

The only way to control the details for payment is at the time the invoice is created if you use api code to create the payment. If you do that, then you can “manually” assign the payment gateway at that time.

Payment plans can’t be edited after the fact because if they could be then the actual payment (or billing) for the invoice would potentially not match the payment plan after it was created. So it can only be done at the time of invoice creation/payment and that can only be done with api code.