Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. stripeHeaders(headers: Headers) {
  2. headers.append('Content-Type', 'application/x-www-form-urlencoded');
  3. headers.append('Authorization', 'Bearer ' + this.apiKey);
  4. }
  5.  
  6. updateBilling(customerId, cardNumber, expiryMonth, expiryYear, cvc): Observable<any> {
  7. let headers = new Headers();
  8. this.stripeHeaders(headers);
  9. let jsonParams = {
  10. source: {
  11. object: 'card',
  12. number: cardNumber,
  13. exp_month: expiryMonth,
  14. exp_year: expiryYear,
  15. cvc: cvc
  16. }
  17. }
  18. let stringParams = 'source={"object":"card","number":' + cardNumber + ',"exp_month":' + expiryMonth + ',"exp_year":' + expiryYear + ',"cvc":' + cvc + '}';
  19. return this.http.post('https://api.stripe.com/v1/customers/' + customerId, body, { headers: headers } )
  20. .map(res => res.json());
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement