Answers for "Received unknown parameter: stripe create card"

0

Received unknown parameter: stripe create card

const source = {
      'source[object]': 'card',
      'source[number]': cardInputs.values.number.replace(/ /g, ''),
      'source[exp_month]': cardInputs.values.expiry.split('/')[0],
      'source[exp_year]': cardInputs.values.expiry.split('/')[1],
      'source[cvc]': cardInputs.values.cvc,
      'source[currency]': Config.PAYMENT_CURRENCY,
      'source[name]': 'Jenny Rosen',
      'source[address_line1]': 'YOUR_ADDRESS_LINE1',
      'source[address_line2]': 'YOUR_ADDRESS_LINE2',
      'source[address_city]': 'YOUR_CITY',
      'source[address_state]': 'YOUR_STATE',
      'source[address_zip]': 'YOUR_PINCODE',
      'source[address_country]': 'India'
    }
    return fetch(`https://api.stripe.com/v1/customers/${customerId}/sources`, {
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/x-www-form-urlencoded',
        Authorization: `Bearer ${"STRIPE_SECRET_KEY"}`
      },
      method: 'post',
      body: Object.keys(source)
        .map(key => key + '=' + source[key])
        .join('&')
    }).then(response => response.json());
Posted by: Guest on September-29-2021

Browse Popular Code Answers by Language