Charge with stripe by customer token

I am a bit confused how to charge with Stripe, if I understood correctly, if customer is new first I should provide a CC form to send his CC info to Stripe as mentioned here:
then with that returned token I may either directly charge the card as mentioned here

or use that token to create a customer first then charge the card as mentioned here

Next time I can retrieve customer now how can I charge an existing customer? In response of retrieving a customer what should I fetch to pass to charge his card again?
Or creating customer is for reference purpose only and everytime I should provide CC form to charge his card via Stripe and cannot charge his card by retrieving a customer?

I think after create a card token and create a customer I have to Create Card to attach the card to the customer?
Then I can Retrieve the card and now to charge it with as there is no tok_* in the response of retrieve card?

Well, I created this code:

$t = \Stripe\Token::create(array( "card" => array(
"number" => "4242424242424242",
"exp_month" => 11,
"exp_year" => 2016,
"cvc" => "314"  )));
$c = \Stripe\Customer::create(array(
  "description" => "Customer for",
  "source" => $t->id));

With this I could create a CC token and assign it to customer to create a customer too.
Now I can retrieve the customer by:


But for next time how can I create a charge just by retreiving existing customer without asking him to enter his CC on form again?

another question is that how can I use at the same time do Charge::create and Customer::create for the same card as token is one-time use only?

yes - you can create a charge either on a card or on a customer

After submitting my Stripe.js-powered form, it seems $_POST[‘stripeToken’] has a value but when I call immediately:


 $customer = \Stripe\Customer::create(array(
             "source" => $_POST['stripeToken'],
             "description" => "blah"

I get no such token error, but if I create token by Card like, it works fine. What is the problem?

You don’t need the form to process payments for a customer - you just need the customer token that was returned when you set up the customer.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.