I’m attempting to create a payment profile. I’ve successfully created a customer profile, but there appears to be no way to attach a credit card to the customer account. I’ve been using authorize.net where this is very straightforward procedure. I see a “card” structure that has last four digits and bin properties, but those appear to be read-only. Is there any code samples that actually do this?
With Square once the card is tokenized there isn’t a way to get the card information. You can tokenize the card then save the card on file with the Cards API for future purchases.
When you create a payment, you can send the customer_id of the customer associated with the payment.
You can also Add a card on file to an existing customer with the Create card call using source_id(string). Which is the ID of the source which represents the card information to be stored. This can be a card nonce or a payment id.
I’m a little confused. So exactly how is the token created?
The card is tokenized with the Web Payments SDK.
I was able to generate a token using the SDK. It took me a few minutes to figure out what a “postcode” is.
Thanks for the help.
Fantastic! Feel free to reach out if you have any additional questions. We’re always happy to help.
Just so I’m understanding the process, once you have the token you can store that token in a database and anytime the customer uses that credit card you simply use the token?
Not exactly. Once you have the token you’ll create the card on file with the Cards API. The response from the Cards API will have a
card_id that’s the value you will store in your database.
Is there any way to update the expiration date?
With the Cards API there isn’t a way to update the card on file. Currently we do update the cards on file on our end if the card company provides us with the information. Otherwise you’ll need to create a new card on file.