dmfgkdg Posted September 15, 2016 Share Posted September 15, 2016 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.phpcharge.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. Quote Link to comment https://forums.phpfreaks.com/topic/302193-php-code-showing-before-echo-echo-shows-fine-though/ Share on other sites More sharing options...
dmfgkdg Posted September 15, 2016 Author Share Posted September 15, 2016 sorry, the resulting page actually shows: 'customer@example.com', 'source' => $token )); $charge = \Stripe\Charge::create(array( 'customer' => $customer->id, 'amount' => 999, 'currency' => 'usd' )); echo ' Successfully charged $9.99 test amount!'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/302193-php-code-showing-before-echo-echo-shows-fine-though/#findComment-1537572 Share on other sites More sharing options...
Jacques1 Posted September 15, 2016 Share Posted September 15, 2016 No, the page shows the entire PHP script. Look at the HTML source. Obviously there's something wrong with how you include the charge.php code in the index.php script. That's the part we need to see. Quote Link to comment https://forums.phpfreaks.com/topic/302193-php-code-showing-before-echo-echo-shows-fine-though/#findComment-1537576 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.