Search the Community
Showing results for tags 'stripe'.
-
I'm testing a payment transaction with Stripe and have followed instructions as indicated on the Stripe API reference manual and also from a youtube video. There are 3 file I am working with: single.html (this is the test product page) config.php charge.php when I try to run a test transaction, everything works but the resulting charge.php page displays the PHP code before the echo message. The echo message is properly displayed, but upon review of the API reference guide and youtube video, I dont know why on their examples, the code does not show. So instead of displaying only: Successfully charged $9.99 test amount! the charge.php (https://p10.secure.hostingprod.com/@the-jewelry-district.com/ssl/home/index.php?page=charge.php) page shows: <?php require_once('---the config file----'); $token = $_POST['stripeToken']; $customer = \Stripe\Customer::create(array( 'email' => 'customer@example.com', 'source' => $token )); $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => 1, 'currency' => 'usd' )); echo '<h1>Successfully charged $9.99 test amount!</h1>'; ?> 'customer@example.com', 'source' => $token )); $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => 1, 'currency' => 'usd' )); echo '[/size] Successfully charged $9.99 test amount! '; ?>[/size] this is only in test mode. It's bugging me a lot. I need to know why this is happening to avoid any mistakes down the line. [/size] The product page is at: https://p10.secure.hostingprod.com/@the-jewelry-district.com/ssl/home/index.php?page=single.html you can use 4242424242424242 as the cc number and any dummy info to test the transaction. Just cant figure it out.
-
Hi Guys, Can someone please help me. I have following PHP code that works fine. I get Stripe token, I get all good results, and see that Stripe transaction appears in my test account. This scenario should work if: Shelly buys widget from Paul and pays Paul directly. I made this code to to make sure I get good results from simplest type of transaction, and I do, it works fine. \Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY); $charge = \Stripe\Charge::create(array( "amount" => $amount, // amount in cents "currency" => "usd", "source" => $token, "description" => $email ) ); But when I try to add these two parameters, so that: Shelly uses Jill's site to buy widget, Jill gets 1.50 as a fee, Paul gets 18.50 for widget. I'm Jill, and this is my code to try and send Paul his money and get my 1.50. I don't want managed account scenario, I want direct connect so that Paul deals with refunds, etc. Private key below is Jill's (my) private key and the destination below is Paul's Stripe ID \Stripe\Stripe::setApiKey(STRIPE_PRIVATE_KEY); \Stripe\Charge::create(array( 'amount' => $amount, 'currency' => 'usd', 'source' => $token, 'application_fee' => $jillfee, 'destination' => 'rp_16ElxDFGdfgFGd7jL7Vj4QU' )); I do have a try/catch in place and when I use this catch area, I get result 5 } catch (\Stripe\Error\Card $e) { // Card was declined. $e_json = $e->getJsonBody(); $err = $e_json['error']; $errors['stripe'] = $err['message']; echo '1 card declined'; } catch (\Stripe\Error\ApiConnection $e) { echo '2 Network problem, perhaps try again.'; } catch (\Stripe\Error\InvalidRequest $e) { echo '3 You screwed up in your programming.'; } catch (\Stripe\Error\Api $e) { echo '4 Stripe servers are down!'; } catch (\Stripe\Error\Base $e) { echo '5 Something else that is not customer fault.'; } any help very much appreciated!
-
Hi Guys, Can someone please help me. I have following PHP code that works fine. The only issue I am facing is, if there is a payment thats not sucessfull I just get a blank screen, and do not receive error on the screen. However the error is dispalyed in execption, I just can catch it. CODE: <?PHP require './lib/Stripe.php'; $ccnum=$_GET['ccNum']; $ccmon=$_GET['ccExpMo']; $ccyr=$_GET['ccExpYr']; $amount=$_GET['amt']; $jobid=$_GET['JobId']; $multiply=100; $amountcents=$amount*$multiply; $cvc=172; $description='something'; if(isset($_POST)) { Stripe::setApiKey("stripe_key_here"); $payment = Stripe_Charge::create(array( 'amount' => $amountcents, 'currency' => 'gbp', 'card' => array( 'number'=> $ccnum, 'exp_month' => $ccmon, 'exp_year'=> $ccyr, 'name'=> 'some name', 'cvc'=> $cvc), 'description' => $description)); } print_r($payment); ?> Following is the error (or any other error) which I cant seem to catch as an execption. error: message: "Your card has insufficient funds." type: "card_error" code: "card_declined" charge: ch_12asdasweAAFdgooXDUd2tvKJgW Thanks a lot again for any advise. Regards,
-
Iv got the stripe checkout button working with its own static fields. Iv got a form which I want to pass the name , email and amount data to the stripe charge page. the amount is calculated and stored in this variable : grand_total here is the code for the charge page : <?php require_once(dirname(__FILE__) . '/config.php'); $token = $_POST['stripeToken']; $customer = Stripe_Customer::create(array( "email" => 'email', "card" => $token, )); $charge = Stripe_Charge::create(array( 'customer' => $customer->id, 'amount' => 2499, 'currency' => 'usd' )); echo '<h1>Successfully charged $24.99!</h1><br/>'; $_SESSION['stripeToken'] = $token; ?> Here is the code for the form fields : <div class="formfield"><label for="Name" class="formlabel">Name</label><input type="text" name="Name" id="Name" size="50" /></div> <div class="formfield"><label for="Email_Address" class="formlabel">Email</label><input type="text" name="Email_Address" id="Email_Address" size="50" /></div> Thanks for the help