#dheeraj_44691
1 messages · Page 1 of 1 (latest)
hi! did you have a question?
what guide are you following to build the code that is generating this error?
$stripe = new \Stripe\StripeClient('sk_test_51Ng8nGFHg4FKe0LChiuMqru5GjWZESzJFKvAoZSJw2LTkIfScUnxvt4AaFLL9006IgLtTNv');
$token = $stripe->tokens->create([
'card' => [
'number' => '4242424242424242',
'exp_month' => 8,
'exp_year' => 2024,
'cvc' => '456',]
]);
Uncaught (Status 402) (Request req_IrKNvFpyzgBDxe) Sending credit card numbers directly to the Stripe API is generally unsafe. We suggest you use test tokens that map to the test card you are using, see https://stripe.com/docs/testing. To enable raw card data APIs in test mode, see https://support.stripe.com/questions/enabling-access-to-raw-card-data-apis
Use test cards to validate your Stripe integration without moving real money. Test a variety of international scenarios, including successful and declined payments, card errors, disputes, and bank authentication. You can also test non-card payment methods and redirects.
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
yep, as the error message says, you are not allowed to pass a raw card number to the API.
was there a particular guide you were following or a reason you thought that as the right way to do it? If you'd like to write code to accept a payment on Stripe, the guide to start with is https://stripe.com/docs/payments/accept-a-payment