Jump to content
Larry Ullman's Book Forums

STRIPE Capturing Charges


Recommended Posts

Thanks to the advice received, I am making progress.  I can send a charge for payment and receive confirmation that it is marked as 'paid'.

But I have a puzzlement re page 518 re 'capturing charges'.  Firstly, it seems that the charge_id is the token - is my understanding on this point correct?  I used that anyway in the 'retrieve' statement and it did not object.  (I am adapting Larry's code here for my own purposes, in fact a single charge).

The '$charge->paid returns true which I test in my code and I can also see it in the Stripe test log.  It does this whether I invoke the 'retrieve' and 'capture' statements or not.

But the dashboard does not show any $s even though I have now sent dozens of charges all of which have returned true for paid.

Any advice will be most appreciated and thank you in anticipation.

Necuima

zz-stripe-dashboard-2.jpg

Link to comment
Share on other sites

Mmmm, I have the charge captured now but to be truthful I don't properly understand this.

I retrieved the id from the response body:

$charge__id = $charge->id;
$charge = \Stripe\Charge::retrieve($charge__id);
$charge->capture();

and the id is clearly not the token.  So I hope that I am doing it correctly!

A further query, I cannot see 'response_reason_text' in the log so maybe it is only there if the charge gets rejected?

Again, any advice will be most appreciated.

Thanks, Necuima

Link to comment
Share on other sites

To clarify, the chard ID is not the same as the token. The token is the representation of the payment method, which is used to create a charge. 

As for not seeing the charges in the Dashboard, you are looking at test data, which should show the results. I'd look at the logs in the Dashboard to see if requests are being made and also confirm you're using the right API keys.

Link to comment
Share on other sites

 Share

×
×
  • Create New...