@shifoodew You can’t use test tokens in live mode. Test tokens are for, well, test mode.
Stripe Error: Invalid token id: tok_visa
Hi, I'm new to stripe and I encountered this error in the Live server.
Card type: Mastercard
I tested this card in my local development 5555555555554444 Mastercard but I don't encounter an error
but in the live server, I encountered this error using an actual card (Card type: Mastercard )
Invalid token id: tok_visa {"exception":"[object] (Stripe\Error\InvalidRequest(code: 0): Invalid token id: tok_visa
this is my local and live code
$customer= Customer::create([
'email' => request('stripeEmail'),
'source' => request('stripeToken')
]);
$charge_customer= Charge::create([
// 'customer' => $customer_card,
'source' => 'tok_visa',
'description' => $product_data->name. 'x'.$qty,
// 'description' => $product->name. ' x'.$qty,
'amount' => round($total_amount * 100), //Cents format
'currency' => 'aud',
'receipt_email' => $email,
'metadata' => array(
"product_id" => $product_data->id,
"product_name" => $product_data->name,
"quantity" => (int)$qty,
"product_type" => $product_type,
"sub_type" => $subtype,
"user_id" => $student_data->id,
"fullname" => $student_data->first_name." ".$student_data->last_name,
"email" => $email,
"Payment made" => "Thru Stripe using Whitebelt App"
),
'application_fee' => round($platform_fee * 100), //Cents format
], array('stripe_account' => $CONNECTED_STRIPE_ACCOUNT_ID ) );
what should I do to fix and avoid that error?
catch(\Stripe\Error\Card $e){
return['error' => $e];
}catch (\Stripe\Error\RateLimit $e) {
return['error' => $e];
} catch (\Stripe\Error\InvalidRequest $e) {
return['error' => $e];
} catch (\Exception $e) {
return['error' => $e];
}
and what test card should I used to generate that error?
I already tested this card number
4000000000000341
Attaching this card to a Customer object succeeds, but attempts to charge the customer fail.
any help will do.
Please or to participate in this conversation.