skip to Main Content

I am trying to do payment in strip but it’s give an error like this.

Sending credit card numbers directly to the Stripe API is generally unsafe. To continue processing use Stripe.js, the Stripe mobile bindings, or Stripe Elements. For more information, see https://dashboard.stripe.com/account/integration/settings.

2

Answers


  1. To ensure secure and compliant payment processing with Stripe, you should generate payment tokens on the front end and then pass those tokens to your backend for further processing. Here’s how you can do it step-by-step:

    Front-end integration (Client-side):
    a. Include the Stripe.js library in your front-end code. You can include it via a script tag or use a package manager like npm or yarn to install it.
    b. Set up the necessary form fields to collect card information securely. Use Stripe Elements or other Stripe-provided UI components to handle card input fields.
    c. When the customer submits the payment form, use Stripe.js to tokenize the card information and obtain a payment token.
    d. The payment token contains a secure representation of the customer’s card information and can be safely passed to your backend for further processing.

    Back-end integration (Server-side):
    a. Receive the payment token from the frontend as part of the form submission or API request.
    b. In your server-side code, use the Stripe API to process the payment using the payment token received from the front end. You can create a new payment method, create a new customer, or charge an existing customer using the payment token.
    c. Stripe will handle the actual payment processing securely on their servers, so your backend never has direct access to sensitive card information.

    By following this approach, you adhere to Stripe’s best practices for secure payment processing. It ensures that sensitive credit card data never touches your backend, reducing the risk of security breaches and helping you maintain PCI compliance.

    Here are some useful resources to help you get started with Stripe.js and tokenization:

    Stripe.js documentation: https://stripe.com/docs/js
    Stripe Elements documentation: https://stripe.com/docs/stripe-js
    Stripe API reference for creating tokens: https://stripe.com/docs/api/tokens/create_card
    Always remember to keep your Stripe API keys secure and never expose them on the client-side to prevent potential security issues.

    Login or Signup to reply.
  2. The error message you’re seeing is due to Stripe’s recommendation against sending credit card numbers directly to their API due to security risks. Instead, they advise utilizing secure libraries like Stripe.js and Stripe Elements, that allow for client-side collection of card information in a secure manner.

    Two primary methods are particularly recommendable:

    Stripe Elements: This set of pre-built UI components provides a secure method for collecting customer card details directly from the browser without having them pass through your servers. Here is a basic implementation:

    1. Stripe Checkout Session: Here, a pre-built, customisable checkout page from Stripe is used which you can just redirect your customers to.

    2. Stripe Elements: This set of pre-built UI components provides a secure method for collecting customer card details directly from the browser without having them pass through your servers. Here is a basic implementation:

    Both options handle tokenizing and securing card data, enabling you to meet compliance requirements such as PCI-DSS.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search