0
votes

I am getting error with the following code

$charge = \Stripe\Charge::create( array(  'card'       => $myCard, 
                                              'amount'     => $post['job_cost']*100, 
                                              'currency'   => 'usd',
                                              'description'=> "Charge from ".$_SESSION['email'] . " (".$_SESSION['organization'].") for job " . $post['job_title'],
                                              'customer'   => "cus_7XOlaXPFww6URY"
                                            )
                                     );

if I include "cutomer" then the error is

An uncaught Exception was encountered

Type: Stripe\Error\InvalidRequest

Message: Invalid string: {"number"=>"424242******4242", "exp_month"=>"1", "exp_year"=>"2016", "cvc"=>"***", "object"=>"card"}

1
If you pass a customer id, card must be a string representing a card id of a card already added to the customer.Matthew Arkin

1 Answers

0
votes

You should use either the 'customer' or 'source' attributed but not both. From the current String create_charge PHP API documentation is seems 'card' is not a valid attribute.