条纹付款:获取错误,因为客户cus _ *****没有带ID ID的链接卡_ ***** [英] Stripe Payment: Getting Error as Customer cus_***** does not have a linked card with ID tok_*****

查看:302
本文介绍了条纹付款:获取错误,因为客户cus _ *****没有带ID ID的链接卡_ *****的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在测试模式下,当我创建新客户并尝试付款时,我收到此错误。

In testing mode when I create a new customer and tries for payment, i got this error.


客户cus_7Zz2BCnybIZLGw没有ID为
的链接卡tok_17Kp8GAwLkQPB7OqrrM73VVI

Customer cus_7Zz2BCnybIZLGw does not have a linked card with ID tok_17Kp8GAwLkQPB7OqrrM73VVI

我使用卡号:4242424242424242
exp_month:12
exp_year 2016

Im using card number : 4242424242424242 exp_month :12 exp_year 2016

返回响应是,

Array
(
    [charge_status] => 
    [error_info] => Array
        (
            [type] => invalid_request_error
            [message] => Customer cus_7Zz2BCnybIZLGw does not have a linked card with ID tok_17Kp8GAwLkQPB7OqrrM73VVI.
            [param] => card
            [code] => missing
        )

    [message] => Customer cus_7Zz2BCnybIZLGw does not have a linked card with ID tok_17Kp8GAwLkQPB7OqrrM73VVI.
)

输入费用数据是,

 $customer = Stripe_Customer::create(array(
      'account_balance' => 100,
      'source' => $token,
      'email' => strip_tags(trim($email))
    )
  );

$customer_id = $customer->id;

$charge   = array(
                'card'          => 4242424242424242, 
                'amount'        => 100, 
                'currency'      => 'cad', 
                'receipt_email' => test@test.com,
                'description'   => 'my payment',
                'customer'      => $customer_id
              );


推荐答案

设定费用

  • with the source parameter only. In this case, source needs to be a token or source ID (created by Checkout or Stripe.js), i.e. a string that starts with tok_ or src_.

仅限 customer 参数。在这种情况下,客户需要是客户 ID,即以 cus _ 开头的字符串。将收取客户的默认付款来源。

with the customer parameter only. In this case, customer needs to be a customer ID, i.e. a string that starts with cus_. The customer's default payment source will be charged.

包含客户 source 参数。在这种情况下, customer 需要是前一种情况下的客户ID,但 source 应该是ID已附加到客户的付款来源。付款来源可以(ID以卡_ ),银行帐户(ID以 ba _ )或来源(ID以 src _ )。

with both the customer and source parameters. In this case, customer needs to be a customer ID as in the previous case, but source should be the ID of a payment source that is already attached to the customer. Payment sources can be cards (ID starts with card_), bank accounts (ID starts with ba_) or sources (ID starts with src_).

在您的情况下,您在 source 参数以及 customer 参数中的客户ID。

In your case, you're passing a token ID in the source parameter along with a customer ID in the customer parameter.

如果这样是一张新卡,您应首先使用该令牌在客户上创建卡,然后创建带卡ID的费用。如果已经为该客户保存了该卡,则您不需要再次收集卡信息(因此根本不需要创建令牌)。

If this is a new card, you should first use the token to create a card on the customer, then create the charge with the card ID. If the card was already saved for this customer, then you don't need to collect the card information again (and thus don't need to create a token at all).

这篇关于条纹付款:获取错误,因为客户cus _ *****没有带ID ID的链接卡_ *****的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆