簡體   English   中英

(Stripe API)能夠獲取bank_account令牌,而不是卡令牌

[英](Stripe API) Able to obtain bank_account token, but not card token

我可以為bank_account創建客戶端令牌,但無法以相同的方式為card (令牌關聯帳戶); 該文檔表明這些過程幾乎相同。

使用bank_account

使用以下客戶端(JS),我可以創建令牌; 令牌被返回。

result = stripe.createToken('bank_account', {
        account_holder_name: 'Test Account Holder',     
        account_holder_type: 'individual',
        account_number:'000123456789', // Stripe test account number
        routing_number: '110000000', // Stripe test routing number
        currency: 'usd',
        country:'US'
}).then(function(result) {
    console.log("OK");
    console.log(result);
}).catch(function(error) {
    console.log("ERROR:");
    console.log(error);
});

無法使用card

但是,當我用card參數和以下必需參數替換bank_account參數時,出現以下錯誤:

result = stripe.createToken('card', {
        number: '5200828282828210', // Stripe testing card
        exp_month: '12',
        exp_year:'2020',
        cvc: '1234',
        currency: 'usd',
        name:'Test Account Holder Name',
        default_for_currency: true      
}).then(function(result) {
    console.log("OK");
    console.log(result);
}).catch(function(error) {
    console.log("ERROR:");
    console.log(error);
});

Error: Invalid value for token type: value should be one of the following strings: account, bank_account, pii, apple_pay. You specified: card.

我的困惑:

該錯誤表明我使用了其他一些參數,而card不是這些參數之一。

我知道pii基本上是用於SSN(美國)的,我剛剛成功使用了bank_account ,而card版本(根據其文檔)似乎是相同的。 我已經嘗試過account它的破解(無濟於事),並且apple_pay顯然不適用。

為什么會收到此錯誤? 我該如何解決並收到card令牌。

card應該是您提供的卡對象的密鑰-您在逗號處應該有一個冒號。

result = stripe.createToken('card': {
    number: '5200828282828210', // Stripe testing card
    exp_month: '12',
    exp_year:'2020',
    cvc: '1234',
    currency: 'usd',
    name:'Test Account Holder Name',
    default_for_currency: true      
}).then(function(result) {
  console.log("OK");
  console.log(result);
}).catch(function(error) {
  console.log("ERROR:");
  console.log(error);
});

問題是您不能將原始卡詳細信息傳遞給客戶端方法。 默認情況下,此功能被阻止,因為它會影響您的PCI合規性狀態。 在此處進行記錄: https : //stripe.com/docs/security#validating-pci-compliance

相反,您需要使用Elements 該庫提供UI組件,可用於在客戶端安全地收集卡詳細信息。 您可以在此處查看一些實際的示例: https : //stripe.github.io/elements-examples/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM