The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

how to delete customer saved payment info?

One of our customers requested that the saved payment information on their account be removed, and they do not want new payment info to be saved on their account. I understand that this information can only be removed via the API. I looked at the docs and have been trying to perform this action with CURL via command line. I am able to do a successful customer_get action, but I haven't been able to figure out from the docs the proper syntax for deleting the saved payment attributes. Here's what I've tried:

curl -d "api_token=MY_API_KEY&api_action=attribute_delete&type=customer&identifier=MY_CUSTOMER_ID&name=cc_number" https://secure.verdanttea.com/api
Returns: ERROR -- Attribute Not Found

curl -d "api_token=MY_API_KEY&api_action=customer_save&customer_id=MY_CUSTOMER_ID&save_cc=false" https://secure.verdanttea.com/api
Returns: SUCCESS -- Customer Updated ... BUT the cc_type, cc_number_masked, cc_exp_month, and cc_exp_year are still all returning saved data.

What am I doing wrong here?

As an aside, I wish there were a more straightforward way to perform this action. One other thing I want to mention is that at checkout (in ver. 2.0) it seems that the customer is only given the option of saving BOTH their payment info and their addresses. The message next to the checkbox reads "Save my address & payment info for next time." Is it really the case that customer address info can only be saved if payment info is also saved, or is this just a default in the language customizations? In the case of the customer I'm working with now, it would be preferable for them to have the option of saving ONLY their addresses and not their payment info. In previous FC versions it seemed that customers had the option of checking the box to save just their payment information specifically rather than both their payment and address information. Can you clarify this for me? I'd like to understand better so I can explain to the customer whether they need to use guest checkout every time, or if there's a way for them to save only their address information and not the payment information.

Thanks for your help!

Comments
  • fc_adamfc_adam FoxyCart Team
    @Geoffrey,

    Thanks for posting what you've tried. With the original API which you're using there, it isn't possible to delete the saved information like that - but you can replace it with fake information to clear out the real stuff when performing a customer_save.

    Using our new Hypermedia API - it should be possible there. It's a more complex set up than the original API, but it also gives a whole lot more flexibility. I need to confirm with another team member the approach for clearing it out with the Hypermedia API as it wasn't working as I expected in a quick test just now. I'll follow up when we have a resolution there.
    Is it really the case that customer address info can only be saved if payment info is also saved, or is this just a default in the language customizations?
    In 2.0 we did make a change there to simplify it to one option, where the customer record will save both address and payment information when creating an account. If the customer doesn't want their information saved, they'll need to check out as a guest on a 2.0 store.
  • fc_adamfc_adam FoxyCart Team
    @Goeffrey,

    Thanks for your patience. We fixed up the issue we spotted yesterday.

    Using the Hypermedia API - you can submit a PATCH request to the customers default_payment_method (reference), passing save_cc as false. This will clear out the saved payment details attached to the customer record.

    You can review general getting started information about our new API at https://api.foxycart.com. If you have any questions about getting started - don't hesitate to ask!
  • @fc_adam,

    Thanks for the hAPI reference. I was able to successfully set up a client and get the required store access token using the FoxyClient, then completed the action using the HAL browser. Took a few attempts to figure out the client setup and store connection, but I got it working.
  • fc_adamfc_adam FoxyCart Team
    @Geoffrey,

    That's great to hear! We know it's a bit confusing getting started with the API, we're working on some improved documentation around that now.
Sign In or Register to comment.