stripe cancel subscription At Period End using curl php
In this post we will show you stripe cancel subscription At Period End using curl php, hear for stripe cancel subscription At Period End using curl php we will give you demo and example for implement.
stripe cancel subscriptionCanceling subscriptions At Period End using curl php
Subscriptions can be canceled through the API At Period End:
curl https://api.stripe.com/v1/subscriptions/sub_B49U3MADTZ8Onp \ -u sk_test_a85RX6H48G5dfD55FDF77: \ -X DELETE \ -d at_period_end=true
Code for stripe cancel subscription At Period End using curl php
function curl_del($path,$data) { // 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_POSTFIELDS, $data ); 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"; $data = array("at_period_end"=>"true"); $curl_del = curl_del($path,$data); echo "<pre>"; print_r($curl_del); echo "</pre>";
Hope this code and post will helped you for implement stripe cancel subscription At Period End using curl 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