Brad
Brad

Reputation: 99

Cant create customer in Stripe after getting token

After following the "Using Checkout and PHP" documentation line for line I have everything working except the last part.

My code reads like this

<?php
require_once('config.php');

$token  = $_POST['stripeToken'];

$customer = \Stripe\Customer::create(array(
  'email' => '[email protected]',
  'source'  => $token
));

echo '<h1>Successfully charged $50.00!</h1>';
?>

Everything works great I can do a var_dump on the token and see that is working fine, my issue is the customer array. I have tried using Stripe_Customer instead of \Stripe\Customer but it still isn't working.

A few things I might have to note is I downloaded the files manually and I'm using mamp but I dont think thats the problem as I'm able to receive tokens, it just stops working as soon as I add the customer array.

Here is my config.php file

<?php
require_once('../stripe/init.php');

$stripe = array(
 "secret_key"      => "test",
 "publishable_key" => test"
);

\Stripe\Stripe::setApiKey($stripe['secret_key']);
?>

Upvotes: 1

Views: 364

Answers (1)

Brad
Brad

Reputation: 99

Figured it out, it was a TLS update problem. After updating MAMP everything worked.

Upvotes: 1

Related Questions