Set HTTP EndPoint to receive POST from an API

0

I have an Angular app and need to get Webhooks from the API Moip Payments and I need to create an EndPoint to receive POST when an event occurs.

How do I create an EndPoint so that Moip can send these events that occur to my application securely?

In localhost I can not perform the tests, I need a way to define a URL that only with a permission can do the POST.

I want to make sure that only Moip will communicate with my application.

Below is an example of what I need to do:

moip-service.ts:

import { HttpClient, HttpHeaders } from '@angular/common/http';


private api_URL = 'https://sandbox.moip.com.br/assinaturas/v1/';
private notification_URL = 'minha_url_notificacoes';

private httpOptions = {
    headers: new HttpHeaders({
        'Content-Type': 'application/json',
        'Authorization': environment.MoipAPI.apiKey
    })
};

constructor(
    private toastr: ToastrService,
    private http: HttpClient) {
    }

getNotifications(){
    return new Promise((resolve, reject) => {
        this.http.get(this.notification_URL)
            .subscribe((response: any) => {
                resolve();
            }, reject);
    }
);
}
    
asked by anonymous 17.05.2018 / 18:04

0 answers