Okay so I've been looking into this. Stripe.js creates tokens by using 'Elements'. This is a js library that generates field such as cc number field using iframes. After cc info is entered the element can be sent to create a token and receive it in response.
The data entered in this iframe is inaccessible; stripe.js does not allow you to fetch it. Instead you need to fetch the token using the API through php. In this way you can retrieve info such as the last 4 and the expiration date of the card that was entered.
I talked with Tyson about maintaining the current cc form and just populating it with data from the stripe form, but this is not possible since the fields are inaccessible. Instead we need to handle populating those fields in the back end. That being said we may still want to keep and hide the fields in case it is useful for gateways other than stripe. We also need to have a way of avoiding card validation on our end since we don't have the full card number.
So maybe to lay it out more clearly we need to:
- Create a way for the current merchant gateway to replace the admin_clients_account_ccinfo.pdt html, either partially or entirely
- Create a way for the current merchant gateway to provide details such as card last4 and expiration date to the accounts model
- Allow a null card number to be submitted to the accounts model
- Possibly make these dependent on the gateway implementing a new interface
Related to CORE-1085?