Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Notifications

somentelucas edited this page Sep 3, 2018 · 11 revisions

Introduction

It's the best way to sync status from Moip with your system. Do you want to know what's happening with your business and be notified when an order is created, when a payment is authorized or canceled or when other things happen in your account? So, this page may help you! 🙌📢

Notification Preference

Dependencies

import static br.com.moip.helpers.PayloadFactory.payloadFactory;
import static br.com.moip.helpers.PayloadFactory.value;

Features

Index

Create notification preference

List events = new ArrayList();
events.add("ORDER.*");
events.add("PAYMENT.AUTHORIZED");
events.add("PAYMENT.CANCELLED");

Map<String, Object> body = payloadFactory(
    value("events", events),
    value("target", "https://my.site.com/test/receive_notifications"),
    value("media", "WEBHOOK")
);

Map<String, Object> newPreference = Moip.API.notificationPreferences().create(body, setup);

Get notification preference

Map<String, Object> getResponse = Moip.API.notificationPreferences().get("notification_preference_id", setup);

List notification preferences

List<Map<String, Object>> listResponse = Moip.API.notificationPreferences().list(setup);

Remove notification preference

Map<String, Object> response = Moip.API.notificationPreferences().remove("notification_preference_id", setup);

Webhooks

Dependencies

TO DO

Features

Index

Get webhook

You should send the ID of the resource that you want to check (order, payment, refund, etc).

Map<String, Object> response = Moip.API.webhooks().get("resource_id", setup);

List webhooks

Map<String, Object> response = Moip.API.webhooks().list(setup);
Clone this wiki locally