You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//My Payments Report
//This connects to the Stripe Payments api and shows a list of charges
//VARIABLE: { name: "count", display: "Number of Charges" }
// If you're using Composer, use Composer's autoload
require __DIR__ . '/vendor/autoload.php';
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey('StripeTestCodeAPIKEY');
if($count > 100 || $count < 1) throw new Exception("Number of Charges must be between 1 and 100");
// Retrieve a list of 50 most recent charges
$charges = \Stripe\Charge::all(array(
'limit' => 50
));
// Loop through each charge
foreach ($charges->data as $charge) {
// Get the required charge information and assign to variables
$id = $charge->id;
$description = $charge->description;
$created = gmdate('Y-m-d H:i', $charge->created); // Format the time
$amount = $charge->amount/100; // Convert amount from cents to dollars
$currency = $charge->currency;
$rows = array();
foreach($charges as $charge) {
$rows[] = array(
'Charge Id'=>$charge->id,
'Amount'=>number_format($charge->amount/100,2),
'Date'=>date('Y-m-d',$charge->created)
);
}
echo json_encode($rows);
?>
The text was updated successfully, but these errors were encountered:
Working with examples using stripe API, i have tried multiple different methods but can not seem to find a way of the report running.
Following the tutorial, i have created reports>my-reports>payments.php which looks like this based off of the stripe examples on their website https://stripe.com/docs/recipes/generating-custom-reports
The text was updated successfully, but these errors were encountered: