{"id":2832,"date":"2018-03-07T20:44:34","date_gmt":"2018-03-08T02:44:34","guid":{"rendered":"http:\/\/www.mooreds.com\/wordpress\/?p=2832"},"modified":"2022-08-27T10:11:23","modified_gmt":"2022-08-27T16:11:23","slug":"noticing-blocked-charges-in-stripe","status":"publish","type":"post","link":"https:\/\/www.mooreds.com\/wordpress\/archives\/2832","title":{"rendered":"Noticing blocked charges in stripe"},"content":{"rendered":"<p>We recently had our first blocked charge at The Food Corridor. We found out because Stripe kindly sent us a notice. It was blocked because Stripe&#8217;s algorithms determined that it was possibly fraudulent.<\/p>\n<p>This is a pretty rare event (hopefully) but we still want to be prepared to deal with it. In the <a href=\"http:\/\/www.mooreds.com\/wordpress\/archives\/2576\">evolution of admin features<\/a>, this is definitely at level 2, because it involves customers and money.<\/p>\n<p>Luckily <a href=\"https:\/\/github.com\/integrallis\/stripe_event\">stripe_event<\/a> has our backs and we can easily catch a webhook event and send an email if this happens. We just need to figure out what the event looks like.<\/p>\n<p>I searched the stripe API but found nothing about blocked charges. I sent an email into Stripe&#8217;s helpful support system, and shortly thereafter someone had tracked down the event so that we could set up that webhook. Here&#8217;s the event (anonymized):<\/p>\n<pre>{\r\n  \"object\": {\r\n    \"id\": \"ch_xxx\",\r\n    \"object\": \"charge\",\r\n    \"amount\": 100,\r\n    \"amount_refunded\": 0,\r\n    \"application\": null,\r\n    \"application_fee\": null,\r\n    \"balance_transaction\": null,\r\n    \"captured\": false,\r\n    \"created\": 111,\r\n    \"currency\": \"usd\",\r\n    \"customer\": \"cus_xxx\",\r\n    \"description\": \"desc\",\r\n    \"destination\": \"acct_xxx\",\r\n    \"dispute\": null,\r\n    \"failure_code\": \"card_declined\",\r\n    \"failure_message\": \"Your card was declined.\",\r\n    \"fraud_details\": {\r\n      \"stripe_report\": \"fraudulent\"\r\n    },\r\n    \"invoice\": null,\r\n    \"livemode\": true,\r\n    \"on_behalf_of\": \"acct_xxx\",\r\n    \"order\": null,\r\n    \"outcome\": {\r\n      \"network_status\": \"not_sent_to_network\",\r\n      \"reason\": \"highest_risk_level\",\r\n      \"risk_level\": \"highest\",\r\n      \"rule\": {\r\n        \"id\": \"block_if_high_risk__enabled\",\r\n        \"action\": \"block\",\r\n        \"predicate\": \":risk_level: = 'highest'\"\r\n      },\r\n      \"seller_message\": \"Stripe blocked this charge as too risky.\",\r\n      \"type\": \"blocked\"\r\n    },\r\n    \"paid\": false,\r\n    \"receipt_email\": null,\r\n    \"receipt_number\": null,\r\n    \"refunded\": false,\r\n    \"refunds\": {\r\n      \"object\": \"list\",\r\n      \"data\": [\r\n      ],\r\n      \"has_more\": false,\r\n      \"total_count\": 0,\r\n      \"url\": \"\/v1\/charges\/ch_xxx\/refunds\"\r\n    },\r\n    \"review\": null,\r\n    \"shipping\": null,\r\n    \"source\": {\r\n      ...\r\n    },\r\n    \"source_transfer\": null,\r\n    \"statement_descriptor\": \"descriptor\",\r\n    \"status\": \"failed\",\r\n    \"transfer_group\": \"group_ch_xxx\"\r\n  },\r\n  \"previous_attributes\": null\r\n}\r\n<\/pre>\n<p>The key is to look at the outcome type value, and handle blocked failed charges differently than normal failed charges (perhaps by contacting the customer).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We recently had our first blocked charge at The Food Corridor. We found out because Stripe kindly sent us a notice. It was blocked because Stripe&#8217;s algorithms determined that it [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[],"class_list":["post-2832","post","type-post","status-publish","format-standard","hentry","category-stripe"],"_links":{"self":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2832"}],"version-history":[{"count":3,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2832\/revisions"}],"predecessor-version":[{"id":3539,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/posts\/2832\/revisions\/3539"}],"wp:attachment":[{"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2832"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2832"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mooreds.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}