How to know if a streak bid is successful or not
I have php code for credit card payment via lane I am new to php classes so I don't know how to determine if payment is successful 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
(
+3
source to share
2 answers
Sorry, but is there a way to focus on the error too? The above only confirms whether the payment was successful or not. It does not indicate the reason for the rejection.
error:
message: "Your card has insufficient funds."
type: "card_error"
code: "card_declined"
charge: ch_12asdasweAAFdgooXDUd2tvKJgW
Sorry, you cannot leave comments, due to lesser reputation. :(
+1
source to share