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.
I need to fetch payment details from stripe API
https://stripe.com/docs/api/transfers?lang=php
I have tried payouts \Stripe\Payout::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';
\Stripe\Stripe::setApiKey("xxxx");
\Stripe\Stripe::setApiKey("xxxx");
$customers = \Stripe\Customer::all(["limit" => 3]);
$products = \Stripe\Product::all(["limit" => 3]);
$subscriptions = \Stripe\Subscription::all(['limit'=>3]);
$orders = \Stripe\Order::all(["limit" => 3]);
$allpayouts = \Stripe\Payout::all(["limit" => 3]);
$paymentIntent = \Stripe\PaymentIntent::all(["limit" => 3]);
//$payout = \Stripe\Payout::retrieve($allpayouts->data[0]->id);
$invoice = \Stripe\Invoice::all(["limit" => 3]);
echo "<pre>";
print_r($subscriptions);
echo "</pre>";
}
}