Subscription Charge IDs

77 views
Skip to first unread message

Christopher Cosmo Rogers

unread,
Jul 11, 2016, 9:59:09 AM7/11/16
to Stripe API Discussion
Hi

When there is a failure when making a general charge we get back the charge id, eg

    error:
        message: "Your card was declined."
        type: "card_error"
        code: "card_declined"
        decline_code: "fraudulent"
        charge: ch_18***

However when there is a failure when taking out a new subscription we just get

    error:
        message: "Your card was declined."
        type: "card_error"
        param: ""
        code: "card_declined"
        decline_code: "fraudulent"


Any chance of getting the charge id in there as well? Or is there some other way of getting the charge id? (Don't think relying of the charge.failed webhook would be the most reliable?)

Also when successfully taking out a subscription the charge ID isn't returned.

I'm implementing a feature for our customer support to be able to mark our orders as safe if stripe thinks they are fraudulent / look up more details on the failure. Bit hard for subscription payments as don't have the charge id!

Cheers
Chris

Fred Alger

unread,
Jul 11, 2016, 6:07:01 PM7/11/16
to api-d...@lists.stripe.com
Hi Chris,

You're right, you don't get the charge ID back on a failed request to create a subscription. You can get it from the Events API or from the charge.succeeded / charge.failed webhooks:



Either a charge.succeeded or charge.failed webhook will fire on every subscription renewal (and on initial creation), so that can be a good way to track the charges on a subscription.

Hope that helps!

Best,
- Fred.




--
You received this message because you are subscribed to the Google Groups "Stripe API Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-discuss...@lists.stripe.com.
To post to this group, send email to api-d...@lists.stripe.com.
Visit this group at https://groups.google.com/a/lists.stripe.com/group/api-discuss/.

Matthew Arkin

unread,
Jul 11, 2016, 6:08:36 PM7/11/16
to Jake K.
Though on subscription creation (especially if you're doing subscription creation and customer creation at the same time) you would have no idea that the charge.failed webhook is for that request (unless you're doing some horrible like timestamp + last 4 matching on your own end)

Christopher Cosmo Rogers

unread,
Jul 12, 2016, 7:55:19 AM7/12/16
to Stripe API Discussion
Yes, this is my problem, and I'd rather not do some horrible matching!

Remi J.

unread,
Jul 14, 2016, 7:34:24 PM7/14/16
to api-d...@lists.stripe.com
Hey Chris,

Right now, there's not a better way than the matching unfortunately. It's something we might add in the future to the API though as I agree it would be useful to get that information when you get the error.

All the best,
Remi

Christopher Cosmo Rogers

unread,
Jul 15, 2016, 11:43:46 AM7/15/16
to Stripe API Discussion
Ok, thanks. Hopefully it will be added sooner rather than later!

Cheers
Chris
Reply all
Reply to author
Forward
0 new messages