Delete a Customer (and Card) - Stripe

45 views
Skip to first unread message

buil...@gmail.com

unread,
Nov 27, 2017, 3:07:44 PM11/27/17
to cfpayment
How do you delete a customer (card) account using CFPAYMENT.  Im assuming it is unstore, but I cant quite figure out how to get it to work.  Im passing the stripe customer token to it.  Any help?  Code below:

<cfscript>
cfg = { path = "stripe.stripe", TestSecretKey = "#application.stripeSKey#" };
svc = createObject("component", "cfpayment.api.core").init(cfg);
gw = svc.getGateway();
dlt = gw.unstore('#getSToken.stripeID#');
</cfscript>

Brian G

unread,
Nov 29, 2017, 5:36:24 PM11/29/17
to cfpayment

unstore is the right method - you would want to pass in the cus_xxxxxx ID as the parameter tokenId.  Token is a little ambiguous in Stripe's case. In the general case of tokens-as-an-abstraction-for-card-details, that's what the tokenId in cfpayment represents. But in the stripe-specific-case, you want the customer ID.

Brian

buil...@gmail.com

unread,
Dec 7, 2017, 7:14:12 AM12/7/17
to cfpayment
So it goes:

dlt = gw.unstore('tokenID=cus_xxxxxxx');

?

buil...@gmail.com

unread,
Dec 11, 2017, 12:26:04 PM12/11/17
to cfpayment
When I run:

customer = gw.unstore(tokenID = getPayInfo.stripeID);

It fails with an error coming from Stripe.cfc.  It says:

The PAYLOAD parameter to the process function is required but was not passed in.


Im not exactly sure whats going wrong.  When I look at the unstore function in stripe.cfc, it looks like its just taking the TokenID as a string and putting it into the REST url.  Whats the PAYLOAD part?

Gerry

On Wednesday, November 29, 2017 at 5:36:24 PM UTC-5, Brian G wrote:

Brian G

unread,
Dec 16, 2017, 12:53:53 AM12/16/17
to cfpayment
Gerry, 

There's definitely a bug there. I guess I've never deleted a customer on file (there's no charge; why are you deleting them?)  Regardless, I've fixed it with a quick commit: 


You can pull down the latest and should be good to go. Cheers and thanks for the bug report!


Brian


On Monday, November 27, 2017 at 12:07:44 PM UTC-8, buil...@gmail.com wrote:

buil...@gmail.com

unread,
Jan 17, 2018, 5:55:46 AM1/17/18
to cfpayment
Interesting.

I wound up getting it to work like this:

customer = gw.unstore(tokenID = getPayInfo.stripeID);

Gerry

buil...@gmail.com

unread,
Jan 17, 2018, 5:58:53 AM1/17/18
to cfpayment
==>  there's no charge; why are you deleting them?

Ya know?  Im hoping Im implemeting it right.  Im trying to keep stripe in sync with my application.  My app works in a way where a customer stores a CCRD and then we charge it as they do work with us.  So when the customer closes their account, we just delete the reciprocal stripe account.  We store the TXN id to refer to charges made by the account.  Does this not make sense?

Gerry



On Saturday, December 16, 2017 at 12:53:53 AM UTC-5, Brian G wrote:
Reply all
Reply to author
Forward
0 new messages