Stripe create payment method not working in react js

Viewed 19

I am using React js and stripe Card Element to add a new card in my front end App. After I submit the card I am getting 200 success code and the response given below but I cant see my card in my Stripe developer dashboard.

this is my js code

 const { error, paymentMethod } = await stripe.createPaymentMethod({
        type: 'card',
        card: elements.getElement(CardElement),
        billing_details: {
            address: {
                city: 'Anytown',
                country: 'US',
                line1: '1234 Main street',
                line2: '1234 Main street',
                postal_code: '123456',
                state: 'New York'
            },
            email: 'testuser2@test.com',
            name: 'test user 2'
        }
    })

This is the response with http code 200

{"id": "pm_1Lk9...........", "object": "payment_method", "billing_details": { "address": { "city": null, "country": null, "line1": null, "line2": null, "postal_code": "12121", "state": null }, "email": "testuser2@test.com", "name": "test user 2", "phone": null }, "card": { "brand": "visa", "checks": { "address_line1_check": null, "address_postal_code_check": null, "cvc_check": null }, "country": "US", "exp_month": 2, "exp_year": 2023, "funding": "credit", "generated_from": null, "last4": "4242", "networks": { "available": [ "visa" ], "preferred": null }, "three_d_secure_usage": { "supported": true }, "wallet": null }, "created": 166....., "customer": null, "livemode": false, "type": "card" }

I tried with curl command in the terminal referring this but didn't work it for me

0 Answers
Related