stripe cancel subscription using curl in php
In this post we will show you stripe cancel subscription using curl in php, hear for stripe cancel subscription using curl in php we will give you demo and example for implement.
stripe cancel subscriptionCanceling subscriptions
Subscriptions can be canceled through the API:
curl https://api.stripe.com/v1/subscriptions/sub_B49U3MADTZ8Onp \ -u sk_test_a85RX6H48G5dfD55FDF77: \ -X DELETE
Code for stripe cancel subscription using curl in php
function curl_del($path) { // Add your key $headers = array('Authorization: Bearer sk_test_a85RX6H48G5dfD55FDF77'); $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $path); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $result = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); return $result; } // add your subscriptions id $path = "https://api.stripe.com/v1/subscriptions/sub_B49U3MADTZ8Onp"; $curl_del = curl_del($path); echo "<pre>"; print_r($curl_del); echo "</pre>";
Hope this code and post will helped you for implement stripe cancel subscription using curl in php. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve onlincode. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs onlincode.org