Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 482
Praveen Kumar Avatar asked Mar 13 '19 08:03

Praveen Kumar


Video Answer


1 Answers

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

like image 62
Danny Dainton Avatar answered Sep 23 '22 06:09

Danny Dainton