Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

muazzamazaz's avatar

Stripe package issue with live payments

I am using following stripe package with Laravel:

"stripe/stripe-php": "^4.4",

its working fine in test mode but when we do publishable key, the payment is not being deducted from card.

Charge Object:

                $Charge = Charge::create(array(
						"amount" => round($request->total_price*100),
						"currency" => "gbp",
						"source" => $request->stripeToken,
						"description" => "Payment Charge for ".$User->email,
						"receipt_email" => $User->email,
						
					
                    ));

Stripe token is being generated through stripe element and passing that value to controller function.

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": "***"
  }
}
0 likes
1 reply
martinbean's avatar

@muazzamazaz Why do you have credit card details in your request body?!

You‘re also using an ancient version of the Stripe SDK. You say you’re using ^4.4 but the latest version is 7.82.0.

Please or to participate in this conversation.