【问题标题】:Stripe Payment: Customer cus_***** does not have a linked card with ID card_*****Stripe Payment:客户cus_*****没有与身份证联动的卡_*****
【发布时间】:2018-11-19 06:50:52
【问题描述】:

我在 Android 上使用 Stripe 我找不到我做错了什么来得到这个错误:

客户 cus_xxx 没有 ID card_yyy 的链接来源 com.stripe.exception.InvalidRequestException:客户 cus_xxx 没有 ID card_yyy 的链接源。

我已经看到 this SO post 处理类似的问题,但我的不同。

这是我的工作流程:

1.在我的应用程序中,我使用此代码创建了一张卡片

Stripe stripe = new Stripe(context, PUBLISHABLE_KEY);
// Stripe API call to get paymentSourceId
stripe.createToken(card, new TokenCallback(){...});

这个方法是一个 HTTP API 请求,我从这个 web 服务的响应中得到了我的paymentSourceId = card_yyy

2.我通过对后端的 HTTP API 请求获得临时密钥,我从临时密钥中提取 paymentSourceCustomerId = cus_xxx

3.最后我尝试使用此参数创建费用

{
    "amount":2999,
    "currency":"USD",
    "paymentSourceCustomerId":"cus_xxx",
    "paymentSourceId":"card_yyy"
}

然后我得到了错误。

【问题讨论】:

    标签: android stripe-payments


    【解决方案1】:

    如果您通过 paymentSourceCustomerId 传递 paymentSourceId,则需要将该卡与该 customedId 关联。

    您有两个选项可以将卡与客户关联:

    1. 在创建客户时
    curl https://api.stripe.com/v1/customers \
       -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \
       -d description="Customer for emily.harris@example.com" \
       -d source=token
    
    1. 将卡链接到已创建的客户
    curl https://api.stripe.com/v1/customers/cus_D1p9ZtnrPS4XAR/sources \ 
    -u sk_test_BQokikJOvBiI2HlWgH4olfQ2: \   
    -d source=token
    

    更多详情:

    【讨论】:

    • 确实,我的问题是我的卡没有链接到我的客户。非常感谢
    猜你喜欢
    • 2021-01-05
    • 1970-01-01
    • 2022-10-19
    • 2014-09-24
    • 1970-01-01
    • 1970-01-01
    • 2014-08-03
    • 2010-10-16
    • 1970-01-01
    相关资源
    最近更新 更多