Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Stripe error: Received unknown parameters when updating credit card info

$
0
0

My Ionic 4 app uses the Stripe API for managing credit cards. For some reason, I keep getting the ‘Received unknown parameters’ error when trying to update the card info (name, expiration date).

I use HTTP post to send the request to Stripe’s endpoint as follows


const stripeURL = `https://api.stripe.com/v1/customers/${stripeCustomerId}/sources/${stripeCardId}`;
const params = {
      name: this.name,
      exp_month: this.creditCard.expMonth,
      exp_year: this.creditCard.expYear
    };
 const urlparams=new URLSearchParams(params).toString();
 console.log(urlparams);
 const httpOptions = {
      headers: new HttpHeaders({
        'Content-Type': 'application/x-www-form-urlencoded',
        Authorization: 'Bearer ' + environment.stripe.secretKey
      })
    }

    this.http.post(stripeURL, urlparams, httpOptions)
    .subscribe((h) => {
      console.log(h);
    });

and I get the error “Received unknown parameters: name, exp_month, exp_year
I even followed this documentation on Stripe’s site https://stripe.com/docs/api/cards/update?lang=node, and still get the same error.

Any idea on what I’m doing wrong, and how to fix it?

Thanks.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles