0
Through the command prompt I get an access token.
curl -v https://api.sandbox.paypal.com/v1/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: pt_BR" \ -u "my-client_id:my-client_secret" \ -d "grant_type=client_credentials"
In the project I use this token and get a json.
Service.ts
getPayment() {
let token = 'A21AAGsiyUhk3ntiu7MMtkvc_aTKaXyWHdfKRrMV0qqNyPQ1ZzxXrT2oxGGdz8wLVcgZzmwgQ8r1mdMLprw0vsB374AI8D2AA';
const httpOptions = {
headers: new HttpHeaders().set("Authorization", [`Bearer ${token}`]).set("Content-Type", "application/json")
}
return this.http.get("https://api.sandbox.paypal.com/v1/payments/payment/PAY-1826783671569693VLQ2IYVQ", httpOptions)
.pipe(
catchError(this.handleError)
);
}
Component.
this.authService.getPayment().subscribe((response) => {
console.log('abcde', JSON.stringify(response))
});
However, I need to generate this Token automatically, but I don’t know how to send my Client_id and Secret by parameter. Any help?
You have to make a get request for this URL by passing these parameters.
– Eduardo Vargas
I edited my question, maybe I can understand a little better. Thanks
– Felipe XST