Duke Posted October 8, 2014 Share Posted October 8, 2014 RE: Page 518 Capturing charges and the download script stripe_capture.php Should this script work as it is written in book and download? my code below: ------------------- require_once('../includes/lib/Stripe.php');Stripe:: setApiKey(STRIPE_PRIVATE_KEY); $charge = Stripe_Charge::retrieve($charge_id); $charge->capture(); <<<<<<<<<<<This line is not working -------------------- When I echo out the charge_id from the database the value = the value in the charges table. I just performed a live purchase. Then went to stripe website and verified it was not captured nor paid. Then I went to my admin->view_order.php ..Clicked Ship This Order...I get an error message from Stripe. But then when I look in stripe.com under payments the order now shows captured and Status :Paid Your thoughts? Thank you very much. Link to comment Share on other sites More sharing options...
Larry Posted October 8, 2014 Share Posted October 8, 2014 Yes, that should work, assuming you're using the right API key and charge ID and capturing an uncultured charge within the 7 day window. What was the error message you received from Stripe? Link to comment Share on other sites More sharing options...
Duke Posted October 9, 2014 Author Share Posted October 9, 2014 Hey Larry.. many thanks for the quick response....Error message == A System error occurred. We apologize for the inconvenience. Everything else seems to be working..except for the error message.....I did notice that on stripe dashboard...CVC Check is showing Failed... Only diff in my code is the email below... I am leaving this blank... Stripe:: setApiKey(STRIPE_PRIVATE_KEY); $email = ''; $customer = Stripe_Customer::create(array( 'description' => "Customer $email", 'email' => $email, 'card' => $token, 'plan' => 'kip_basic')); Ahhh do not worry about it ...I will keep looking to see if I can find what is not working and then maybe that will lead me to why the error is appearing.... Thank you Link to comment Share on other sites More sharing options...
Larry Posted October 10, 2014 Share Posted October 10, 2014 A system error is most likely a problem with your PHP code. That's not a Stripe error. I'd start by making sure display_errors is enabled. Link to comment Share on other sites More sharing options...
sdiaz83 Posted April 15, 2016 Share Posted April 15, 2016 Retrieving the last 4 digits of the credit card: I'm having problems retrieving the last 4 digits of the credit card used for payment from Stripe, so I can include n the receipt. I have found some information online, but it does not seem to work. Has anyone had any luck with this? Regards, Sam Link to comment Share on other sites More sharing options...
sdiaz83 Posted April 17, 2016 Share Posted April 17, 2016 For anyone still looking for way to retrieve the last4 numbers of the credit card so that they are available for the receipt etc, here is the solution: After Larry's code: $charge =\Stripe\charge::create(array( "amount" => $order_total, "currency" => "usd", "source" = > $token, "description" => $_SESSION['email'], )); place the following line of code: $last4 = $charge->source->last4; then update the order query to replace the previous number from $cc_last_four. Link to comment Share on other sites More sharing options...
Larry Posted May 15, 2016 Share Posted May 15, 2016 Excellent. Thanks for sharing what you figured out! Link to comment Share on other sites More sharing options...
Recommended Posts