Are you accepting and processing credit card details on your server???
$token = Token::create([
'card' => [
'number' => $request->cardno,
'exp_month' => $month,
'exp_year' => $year,
'cvc' => $request->cvc,
],
]);
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
using following stripe package
"stripe/stripe-php": "^4.4",
with code
use Stripe\Charge;
use Stripe\Stripe;
use Stripe\Token;
use Stripe\StripeInvalidRequestError;
use Stripe\Stripe_CardError;
$stripe =Stripe::setApiKey(Setting::get('stripe_secret_key'));
$token = Token::create([
'card' => [
'number' => $request->cardno,
'exp_month' => $month,
'exp_year' => $year,
'cvc' => $request->cvc,
],
]);
if ($request->total_price>14){
$Charge = Charge::create(array(
"amount" => round($request->total_price*100),
"currency" => "gbp",
"source" => $token,
"description" => "Payment Charge for ".$User->email,
"receipt_email" => $User->email,
));
no deduction is being made in live mode without any error
and stripe is log is as follows:
POST /v1/tokens
Status
200 OK
ID
req_rFUPj0Aw5kYkui
Time
5/18/21, 1:39:18 PM
IP address
199.188.200.224
API version
2018-05-21
Source
Stripe/v1 PhpBindings/4.13.0
Response body
{
"id": "tok_1IsT8kEsWwtF0krez5cw74gI",
"object": "token",
"card": {
"id": "card_1IsT8kEsWwtF0kre4Fq0ChK1",
"object": "card",
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "PK",
"cvc_check": "unchecked",
"dynamic_last4": null,
"exp_month": 2,
"exp_year": 2023,
"fingerprint": "rLiMzo6zB4GQuv57",
"funding": "debit",
"last4": "0000",
"metadata": {
},
"name": null,
"tokenization_method": null
},
"client_ip": "199.188.200.224",
"created": 1621345158,
"livemode": true,
"type": "card",
"used": false
}
Request POST body
{
"card": {
"number": "**** **** **** 0000",
"exp_month": "02",
"exp_year": "2023",
"cvc": "***"
}
}
Please or to participate in this conversation.