Pull Payments details from Stripe API












1














I am creating a WordPress plugin, and trying to pull payments details from stripe API done via third party. I have tried everything mention in this code but I am not able to pull data of Payments from stripe.



enter image description here



I need to fetch payment details from stripe API



https://stripe.com/docs/api/transfers?lang=php



I have tried payouts StripePayout::all() but getting empty object



Here is my code:



namespace wpmember;

class WPMember
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'wpdocs_register_my_custom_menu_page') );
}


public function wpdocs_register_my_custom_menu_page()
{
add_menu_page(
'Custom Menu Title',
'custom menu',
'manage_options',
'custom-menu',
$this->connect_stripe()
);

}

public function connect_stripe()
{
require ( PLUGIN_DIR . 'vendor/autoload.php');
//echo PLUGIN_DIR . 'vendor/autoload.php';
StripeStripe::setApiKey("xxxx");
StripeStripe::setApiKey("xxxx");

$customers = StripeCustomer::all(["limit" => 3]);
$products = StripeProduct::all(["limit" => 3]);
$subscriptions = StripeSubscription::all(['limit'=>3]);
$orders = StripeOrder::all(["limit" => 3]);
$allpayouts = StripePayout::all(["limit" => 3]);
$paymentIntent = StripePaymentIntent::all(["limit" => 3]);
//$payout = StripePayout::retrieve($allpayouts->data[0]->id);
$invoice = StripeInvoice::all(["limit" => 3]);

echo "<pre>";
print_r($subscriptions);
echo "</pre>";
}


}









share|improve this question
























  • it would be great if you update your question with the error description you're getting now
    – Alexey
    Nov 20 at 6:53










  • There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
    – Hemant Kumar
    Nov 20 at 7:02










  • heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
    – Alexey
    Nov 20 at 7:03










  • @alexey I have added some more info for your clarity.
    – Hemant Kumar
    Nov 20 at 7:07


















1














I am creating a WordPress plugin, and trying to pull payments details from stripe API done via third party. I have tried everything mention in this code but I am not able to pull data of Payments from stripe.



enter image description here



I need to fetch payment details from stripe API



https://stripe.com/docs/api/transfers?lang=php



I have tried payouts StripePayout::all() but getting empty object



Here is my code:



namespace wpmember;

class WPMember
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'wpdocs_register_my_custom_menu_page') );
}


public function wpdocs_register_my_custom_menu_page()
{
add_menu_page(
'Custom Menu Title',
'custom menu',
'manage_options',
'custom-menu',
$this->connect_stripe()
);

}

public function connect_stripe()
{
require ( PLUGIN_DIR . 'vendor/autoload.php');
//echo PLUGIN_DIR . 'vendor/autoload.php';
StripeStripe::setApiKey("xxxx");
StripeStripe::setApiKey("xxxx");

$customers = StripeCustomer::all(["limit" => 3]);
$products = StripeProduct::all(["limit" => 3]);
$subscriptions = StripeSubscription::all(['limit'=>3]);
$orders = StripeOrder::all(["limit" => 3]);
$allpayouts = StripePayout::all(["limit" => 3]);
$paymentIntent = StripePaymentIntent::all(["limit" => 3]);
//$payout = StripePayout::retrieve($allpayouts->data[0]->id);
$invoice = StripeInvoice::all(["limit" => 3]);

echo "<pre>";
print_r($subscriptions);
echo "</pre>";
}


}









share|improve this question
























  • it would be great if you update your question with the error description you're getting now
    – Alexey
    Nov 20 at 6:53










  • There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
    – Hemant Kumar
    Nov 20 at 7:02










  • heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
    – Alexey
    Nov 20 at 7:03










  • @alexey I have added some more info for your clarity.
    – Hemant Kumar
    Nov 20 at 7:07
















1












1








1







I am creating a WordPress plugin, and trying to pull payments details from stripe API done via third party. I have tried everything mention in this code but I am not able to pull data of Payments from stripe.



enter image description here



I need to fetch payment details from stripe API



https://stripe.com/docs/api/transfers?lang=php



I have tried payouts StripePayout::all() but getting empty object



Here is my code:



namespace wpmember;

class WPMember
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'wpdocs_register_my_custom_menu_page') );
}


public function wpdocs_register_my_custom_menu_page()
{
add_menu_page(
'Custom Menu Title',
'custom menu',
'manage_options',
'custom-menu',
$this->connect_stripe()
);

}

public function connect_stripe()
{
require ( PLUGIN_DIR . 'vendor/autoload.php');
//echo PLUGIN_DIR . 'vendor/autoload.php';
StripeStripe::setApiKey("xxxx");
StripeStripe::setApiKey("xxxx");

$customers = StripeCustomer::all(["limit" => 3]);
$products = StripeProduct::all(["limit" => 3]);
$subscriptions = StripeSubscription::all(['limit'=>3]);
$orders = StripeOrder::all(["limit" => 3]);
$allpayouts = StripePayout::all(["limit" => 3]);
$paymentIntent = StripePaymentIntent::all(["limit" => 3]);
//$payout = StripePayout::retrieve($allpayouts->data[0]->id);
$invoice = StripeInvoice::all(["limit" => 3]);

echo "<pre>";
print_r($subscriptions);
echo "</pre>";
}


}









share|improve this question















I am creating a WordPress plugin, and trying to pull payments details from stripe API done via third party. I have tried everything mention in this code but I am not able to pull data of Payments from stripe.



enter image description here



I need to fetch payment details from stripe API



https://stripe.com/docs/api/transfers?lang=php



I have tried payouts StripePayout::all() but getting empty object



Here is my code:



namespace wpmember;

class WPMember
{
public function __construct()
{
add_action( 'admin_menu', array($this, 'wpdocs_register_my_custom_menu_page') );
}


public function wpdocs_register_my_custom_menu_page()
{
add_menu_page(
'Custom Menu Title',
'custom menu',
'manage_options',
'custom-menu',
$this->connect_stripe()
);

}

public function connect_stripe()
{
require ( PLUGIN_DIR . 'vendor/autoload.php');
//echo PLUGIN_DIR . 'vendor/autoload.php';
StripeStripe::setApiKey("xxxx");
StripeStripe::setApiKey("xxxx");

$customers = StripeCustomer::all(["limit" => 3]);
$products = StripeProduct::all(["limit" => 3]);
$subscriptions = StripeSubscription::all(['limit'=>3]);
$orders = StripeOrder::all(["limit" => 3]);
$allpayouts = StripePayout::all(["limit" => 3]);
$paymentIntent = StripePaymentIntent::all(["limit" => 3]);
//$payout = StripePayout::retrieve($allpayouts->data[0]->id);
$invoice = StripeInvoice::all(["limit" => 3]);

echo "<pre>";
print_r($subscriptions);
echo "</pre>";
}


}






php wordpress api stripe-payments






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 7:07

























asked Nov 20 at 6:00









Hemant Kumar

405317




405317












  • it would be great if you update your question with the error description you're getting now
    – Alexey
    Nov 20 at 6:53










  • There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
    – Hemant Kumar
    Nov 20 at 7:02










  • heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
    – Alexey
    Nov 20 at 7:03










  • @alexey I have added some more info for your clarity.
    – Hemant Kumar
    Nov 20 at 7:07




















  • it would be great if you update your question with the error description you're getting now
    – Alexey
    Nov 20 at 6:53










  • There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
    – Hemant Kumar
    Nov 20 at 7:02










  • heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
    – Alexey
    Nov 20 at 7:03










  • @alexey I have added some more info for your clarity.
    – Hemant Kumar
    Nov 20 at 7:07


















it would be great if you update your question with the error description you're getting now
– Alexey
Nov 20 at 6:53




it would be great if you update your question with the error description you're getting now
– Alexey
Nov 20 at 6:53












There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
– Hemant Kumar
Nov 20 at 7:02




There is no error, I need to pull transaction/payment data as shown in image. Hope you read my question carefully.
– Hemant Kumar
Nov 20 at 7:02












heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
– Alexey
Nov 20 at 7:03




heh :) I hope you read my comment carefully. If there is no error you're getting the expected results, so what's the question?
– Alexey
Nov 20 at 7:03












@alexey I have added some more info for your clarity.
– Hemant Kumar
Nov 20 at 7:07






@alexey I have added some more info for your clarity.
– Hemant Kumar
Nov 20 at 7:07














2 Answers
2






active

oldest

votes


















1














Here you can get the payment details:



require ( PLUGIN_DIR . 'vendor/autoload.php');    
StripeStripe::setApiKey("pk_test_VNbKcUGTqFIlyfIwFgizNx8h");
StripeStripe::setApiKey("sk_test_7VbuCbiZsDZjDHHlOtHeCqo7");

$charges = StripeCharge::all(["limit" => 3]);
print_r($charges);





share|improve this answer





























    0














    You seem to be fetching Payouts which are according to the Stripe API reference are the transfers from your Stripe account to your bank account. Which do not seem to be Charges object you showed on your screenshot or Transfer objects that could be fetched with StripeTransfer::all().






    share|improve this answer





















      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387091%2fpull-payments-details-from-stripe-api%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Here you can get the payment details:



      require ( PLUGIN_DIR . 'vendor/autoload.php');    
      StripeStripe::setApiKey("pk_test_VNbKcUGTqFIlyfIwFgizNx8h");
      StripeStripe::setApiKey("sk_test_7VbuCbiZsDZjDHHlOtHeCqo7");

      $charges = StripeCharge::all(["limit" => 3]);
      print_r($charges);





      share|improve this answer


























        1














        Here you can get the payment details:



        require ( PLUGIN_DIR . 'vendor/autoload.php');    
        StripeStripe::setApiKey("pk_test_VNbKcUGTqFIlyfIwFgizNx8h");
        StripeStripe::setApiKey("sk_test_7VbuCbiZsDZjDHHlOtHeCqo7");

        $charges = StripeCharge::all(["limit" => 3]);
        print_r($charges);





        share|improve this answer
























          1












          1








          1






          Here you can get the payment details:



          require ( PLUGIN_DIR . 'vendor/autoload.php');    
          StripeStripe::setApiKey("pk_test_VNbKcUGTqFIlyfIwFgizNx8h");
          StripeStripe::setApiKey("sk_test_7VbuCbiZsDZjDHHlOtHeCqo7");

          $charges = StripeCharge::all(["limit" => 3]);
          print_r($charges);





          share|improve this answer












          Here you can get the payment details:



          require ( PLUGIN_DIR . 'vendor/autoload.php');    
          StripeStripe::setApiKey("pk_test_VNbKcUGTqFIlyfIwFgizNx8h");
          StripeStripe::setApiKey("sk_test_7VbuCbiZsDZjDHHlOtHeCqo7");

          $charges = StripeCharge::all(["limit" => 3]);
          print_r($charges);






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 20 at 8:17









          Amit Verma

          1419




          1419

























              0














              You seem to be fetching Payouts which are according to the Stripe API reference are the transfers from your Stripe account to your bank account. Which do not seem to be Charges object you showed on your screenshot or Transfer objects that could be fetched with StripeTransfer::all().






              share|improve this answer


























                0














                You seem to be fetching Payouts which are according to the Stripe API reference are the transfers from your Stripe account to your bank account. Which do not seem to be Charges object you showed on your screenshot or Transfer objects that could be fetched with StripeTransfer::all().






                share|improve this answer
























                  0












                  0








                  0






                  You seem to be fetching Payouts which are according to the Stripe API reference are the transfers from your Stripe account to your bank account. Which do not seem to be Charges object you showed on your screenshot or Transfer objects that could be fetched with StripeTransfer::all().






                  share|improve this answer












                  You seem to be fetching Payouts which are according to the Stripe API reference are the transfers from your Stripe account to your bank account. Which do not seem to be Charges object you showed on your screenshot or Transfer objects that could be fetched with StripeTransfer::all().







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 at 7:11









                  Alexey

                  1,93242036




                  1,93242036






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53387091%2fpull-payments-details-from-stripe-api%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      If I really need a card on my start hand, how many mulligans make sense? [duplicate]

                      Alcedinidae

                      Can an atomic nucleus contain both particles and antiparticles? [duplicate]