Tipsi条纹创建令牌+条纹创建费用

时间:2019-10-19 01:53:47

标签: react-native stripe-payments

我不熟悉使用Stripe。我正在使用tipsi-stripe创建令牌

 params: {
            number: '4242424242424242',
            expMonth: 12,
            expYear: 24,
            cvc: '223',
            name: 'Test User',
            currency: 'usd',
            addressLine1: '123 Test Street',
            addressLine2: 'Apt. 5',
            addressCity: 'Test City',
            addressState: 'Test State',
            addressCountry: 'Test Country',
            addressZip: '55555',
        }

创建令牌似乎可行。

  const token = await stripe.paymentRequestWithCardForm(params)
  console.log(token);

然后我调用Firebase云功能

    const amount = val.amount;

    const charge = { amount, currency, customer };

    if (val.source !== null) {
      charge.source = val.source; <- This is my token I generated
    }

    const response = await stripe.charges.create(charge);

然后我得到一个错误

{
  "error": {
    "message": "Invalid string: {:card=>{:addressCountry=>"US", :brand=>"Visa", :cardId=>"card_1FV76IILMvKOGsADwwwvGByj", :country=>"US", :expMonth=>"12", :expYear=>"2024", :funding=>"credit", :isApplePayCard=>"false", :last4=>"4242"}, :created=>"1571449886", :livemode=>"false", :tokenId=>"tok_1FV7wwerfMvKOGsADEHOseFEY", :object=>"card"}",
    "param": "source",
    "type": "invalid_request_error"
  }
}

任何帮助都会很棒。我想将运输信息与创建的费用一起保存。如果不需要,我也不想存储用户卡。

0 个答案:

没有答案