I have php code to charge credit card via stripe I am beginner in php classes, so i don't know how to tell if the payment is succeed or not
<?
require_once('lib/Stripe.php');
Stripe::setApiKey("sk_test_123ABC");
if(isset($_POST)) {
$payment = Stripe_Charge::create(array(
'amount' => '50',
'currency' => 'usd',
'card' => array(
'number'=> '4242424242424242',
'exp_month' => '12',
'exp_year'=> '14',
'cvc'=> '123'),
'description' => 'New payment'
)); }
print_r($payment);
?>
Results
Stripe_Charge Object
(
[_apiKey:protected] => sk_test_123ABC
[_values:protected] => Array
(
[id] => ch_157h99GwRVG4EfR7dCxslaAs
[object] => charge
[created] => 1418105445
[livemode] =>
[paid] => 1
[amount] => 50
[currency] => usd
[refunded] =>
[captured] => 1
[refunds] => Stripe_List Object
(
Your question has its answer.If an object is returned of stripecharge object that means the payment was successfull.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With