Tagged: stripe cancel subscription At Period End using curl php

Stripe Refund Api Tutorial Example From Scratch 0

Stripe Refund Api Tutorial Example

Today, We want to share with you Stripe Refund Api Tutorial Example.In this post we will show you stripe connect api, hear for stripe cancel subscription refund we will give you demo and example for implement.In this post, we will learn about stripe cancel subscription using curl in php with an example.

Stripe Refund Api Tutorial Example

There are the Following The simple About Stripe Refund Api Tutorial Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop stripe cancel subscription At Period End using curl php, so the Stripe Authentication with Connect using PHP for this example is following below.

$ch = Stripe_Charge::retrieve('ch_19DAkJDKgNbxQsQZsCDh98La');
$ch->refunds->create(array('amount' => 100));

How to do refund in Stripe PHP?

You can also do refund as below

\Stripe\Stripe::setApiKey("sk_test_kfjdIFNOtvieiPAKAvc9qFwJ");

 $refund = \Stripe\Refund::create([
            'charge' => 'ch_19DAkJDKgNbxQsQZsCDh98La',
            'amount' => 1000,  // For 10 $
            'reason' => 'refund'
        ]);

$balanceLiveTransaction = \Stripe\BalanceTransaction::retrieve($refund->balance_transaction);

stripe cancel subscription using curl in php

stripe cancel subscriptionCanceling subscriptions Example

curl https://api.stripe.com/v1/subscriptions/sub_B49U3PAKAINFO8Onp \
   -u sk_test_kfjdIFNOtvieiPAKAvc9qFwJ: \
   -X DELETE

Source Code for stripe cancel subscription using curl in php
function delete_curl($path)
{
    // Add Stripe your key
    $headers = array('Authorization: Bearer sk_test_kfjdIFNOtvieiPAKAvc9qFwJ');
    $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;
}
 //Stripe Refund Api Tutorial Example
// add your simple subscriptions id
$path = "https://api.stripe.com/v1/subscriptions/sub_B49U3PAKAINFO8Onp";
$delete_curl = delete_curl($path);
echo "<pre>";
print_r($delete_curl);
echo "</pre>";

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Stripe Refund Api Tutorial Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.