Praveen Kumar
Praveen Kumar

Reputation: 927

Create a card token in Stripe via API POSTMAN

I am creating some API for stripe payment. I try to create API to getting card token for payment. below is my code

Postman Data

Request Method: POST,
Request URL: https://api.stripe.com/v1/tokens

Headers Data

Content-Type:application/x-www-form-urlencoded
Authorization:Bearer SECRET_KEY

Body x-www-form-urlencoded

card:{"exp_month":12,"exp_year":2020,"number":'4242424242424242',"cvc":'123'}

Response (Output)

{
    "error": {
        "message": "You must pass full card details to create a token.",
        "type": "invalid_request_error"
    }
}

Postman screenshots:

Headers

enter image description here

Body

enter image description here

Upvotes: 7

Views: 12158

Answers (1)

Danny Dainton
Danny Dainton

Reputation: 25881

I imported the cURL request from the Stripe documentation into Postman. This request should look like this one below.

Postman

Once, you add the Auth Token into the header - It should then allow you to create the card token (If everything else is ok)

Just for reference, the syntax for the key/value view, should look like this and not like you have it in your request.

Syntax

Upvotes: 18

Related Questions