Note that there are some explanatory texts on larger screens.

plurals
  1. POStripe not creating customers or charges
    primarykey
    data
    text
    <p>I am trying to implement payment through stripe and i had it working a few weeks ago but now it doesn't seem to work. </p> <p>I'm using php to implement:</p> <p>payment.php</p> <pre><code>require('stripe/lib/Stripe.php'); $stripe = array( 'secret_key' =&gt; 'sk_test_???', 'publishable_key' =&gt; 'pk_test_???' ); Stripe::setApiKey($stripe['secret_key']); try{ $customer = Stripe_Customer::create(array( 'card' =&gt; $_POST['stripeToken'], 'email' =&gt; $_POST['email'], 'name' =&gt; $_POST['name'] )); $charge = Stripe_Charge::create(array( 'card' =&gt; $_POST['stripeToken'], 'amount' =&gt; 2500, 'currency' =&gt; 'usd', "description" =&gt; "Charge for ..." )); } catch (Stripe_ApiConnectionError $e) { $errors[] = 'Network problem, perhaps try again.'; } catch (Stripe_InvalidRequestError $e) { $errors[] = 'You screwed up in your programming. Shouldnt happen!'; } catch (Stripe_ApiError $e) { $errors[] = 'Stripe servers are down!'; } catch (Stripe_CardError $e) { $errors[] = 'Card was declined.'; } echo "&lt;p&gt;You have paid!&lt;/p&gt;"; </code></pre> <p>register.php</p> <pre><code>&lt;form id="payment-form" action="" method="POST"&gt; &lt;script src="https://checkout.stripe.com/v2/checkout.js" class="stripe-button" data-key="pk_test_???" data-amount="2500" data-name="Purtrainer" data-description="Monthly Subscription ($25.00)" &lt;/script&gt; &lt;div id="payment-errors"&gt; &lt;? print_r($errors); ?&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>In register.php i have a few text inputs for email, name, password, etc...</p> <p>When i click the "pay with card" button stripe provides in the js code and i will in the test credit card info, my user gets inputted into my database with al the info from the text inputs, but Strip neither creates the customer nor the charge. </p> <p>Any help?</p> <p>Something else to note - going to my payment.php file directly in the URL gives me an error saying there was a problem requiring the stripe file. It says no file exists, even though it does :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload