通过API POSTMAN在条纹中创建卡令牌

时间:2019-03-13 08:51:00

标签: api stripe-payments postman

我正在创建一些用于条带支付的API。我尝试创建API以获取卡令牌进行支付。以下是我的代码

邮递员数据

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

标题数据

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

身体 x-www-form-urlencoded

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

响应(输出)

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

邮递员屏幕截图:

标题

enter image description here

身体

enter image description here

1 个答案:

答案 0 :(得分:1)

我将Stripe文档中的cURL请求导入了Postman。此请求应如下所示。

Postman

一旦您将Auth令牌添加到header-然后,它应允许您创建卡令牌(如果其他方法都没问题)

仅供参考,key/value视图的语法应如下所示,而不是请求中的语法。

Syntax