{
"Url": "https://example.com",
"EventType" : "PAYIN_REFUND_SUCCEEDED",
"Tag": "Created using the Mangopay API Postman Collection"
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$hook = new \MangoPay\Hook();
$hook->EventType = \MangoPay\EventType::MandateFailed;
$hook->Url = 'http://example.com';
$hook->Tag = 'Created using Mangopay PHP SDK';
$response = $api->Hooks->Create($hook);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myHook = {
EventType: 'TRANSFER_SETTLEMENT_CREATED',
Url: 'http://example.com',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createHook = async (hook) => {
return await mangopay.Hooks.create(hook)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createHook(myHook)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createHook(hookObject)
begin
response = MangoPay::Hook.create(hookObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create Hook: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myHook = {
EventType: 'PAYOUT_NORMAL_SUCCEEDED',
Url: 'http://example.com',
Tag: 'Created using Mangopay Ruby SDK'
}
createHook(myHook)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.enumerations.EventType;
import com.mangopay.entities.Hook;
public class CreateHook {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
Hook hook = new Hook();
hook.setEventType(EventType.USER_KYC_LIGHT);
hook.setUrl("http://example.com");
hook.setTag("Create using the Mangopay Java SDK");
Hook createHook = mangopay.getHookApi().create(hook);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createHook);
System.out.println(prettyJson);
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Notification
hook = Notification(
event_type = 'USER_KYC_REGULAR',
url = 'http://example.com',
tag = 'Create using the Mangopay Python SDK'
)
create_hook = hook.save()
pprint(create_hook)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities.POST;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var eventType = EventType.DISPUTE_CREATED;
var url = "https://www.example.com/";
var hook = new HookPostDTO(url, eventType) {
Tag = "Created using the Mangopay .NET SDK"
};
var createHook = await api.Hooks.CreateAsync(hook);
string prettyPrint = JsonConvert.SerializeObject(createHook, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Url": "https://example.com",
"Status": "ENABLED",
"Validity": "VALID",
"EventType": "PAYIN_REFUND_SUCCEEDED",
"Id": "hook_m_01J8F5RK4R43AYWD8XVG9RSYDT",
"Tag": "Created using the Mangopay API Postman Collection",
"CreationDate": 1727086218
}
Webhooks
Create a Hook
Set up a URL to receive notifications of an event type
POST
/
v2.01
/
{ClientId}
/
hooks
{
"Url": "https://example.com",
"EventType" : "PAYIN_REFUND_SUCCEEDED",
"Tag": "Created using the Mangopay API Postman Collection"
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$hook = new \MangoPay\Hook();
$hook->EventType = \MangoPay\EventType::MandateFailed;
$hook->Url = 'http://example.com';
$hook->Tag = 'Created using Mangopay PHP SDK';
$response = $api->Hooks->Create($hook);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myHook = {
EventType: 'TRANSFER_SETTLEMENT_CREATED',
Url: 'http://example.com',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createHook = async (hook) => {
return await mangopay.Hooks.create(hook)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createHook(myHook)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createHook(hookObject)
begin
response = MangoPay::Hook.create(hookObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create Hook: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myHook = {
EventType: 'PAYOUT_NORMAL_SUCCEEDED',
Url: 'http://example.com',
Tag: 'Created using Mangopay Ruby SDK'
}
createHook(myHook)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.enumerations.EventType;
import com.mangopay.entities.Hook;
public class CreateHook {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
Hook hook = new Hook();
hook.setEventType(EventType.USER_KYC_LIGHT);
hook.setUrl("http://example.com");
hook.setTag("Create using the Mangopay Java SDK");
Hook createHook = mangopay.getHookApi().create(hook);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createHook);
System.out.println(prettyJson);
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Notification
hook = Notification(
event_type = 'USER_KYC_REGULAR',
url = 'http://example.com',
tag = 'Create using the Mangopay Python SDK'
)
create_hook = hook.save()
pprint(create_hook)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities.POST;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var eventType = EventType.DISPUTE_CREATED;
var url = "https://www.example.com/";
var hook = new HookPostDTO(url, eventType) {
Tag = "Created using the Mangopay .NET SDK"
};
var createHook = await api.Hooks.CreateAsync(hook);
string prettyPrint = JsonConvert.SerializeObject(createHook, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
{
"Url": "https://example.com",
"Status": "ENABLED",
"Validity": "VALID",
"EventType": "PAYIN_REFUND_SUCCEEDED",
"Id": "hook_m_01J8F5RK4R43AYWD8XVG9RSYDT",
"Tag": "Created using the Mangopay API Postman Collection",
"CreationDate": 1727086218
}
Caution – Setting email for consecutive failures after April 2026In Production, if your platform had
VALID Hook objects before April 2, 2026, then Mangopay automatically populates the Email property on new Hooks with the previously used global address unless and until you set it proactively using this endpoint.If you send the Email on a POST or PUT request, other new Hooks created without the Email do not populate the Email automatically and do not emit alerts in case of consecutive failed notifications or if the Hook becomes INVALID.Platforms integrating after April 2, 2026 must proactively set the Email to receive alerts.Read more about this change →Body parameters
string
required
Allowed values: An
EventType listed in the event types listThe type of the event.string
required
Max. length: 255 charactersThe URL to which the notification is sent.
string
Max. length: 255 charactersCustom data that you can add to this object.
string | null
Format: A valid email addressThe
Email address to which alerts are sent in case of consecutive failed notification attempts.Caution: Mangopay may populate this property automatically if your platform had webhooks integrated in Production before April 2, 2026. If so, setting the Email on a single Hook stops this automatic population for any new Hooks you create - read more.For all platforms, if this property is returned null then no alerts are sent but the Hook still becomes INVALID after 100 consecutive failed notifications.Responses
200
200
string
Max. length: 255 charactersThe URL to which the notification is sent.
string
Returned values:
DISABLED, ENABLEDWhether the hook is enabled or not.string
Returned values:
VALID, INVALIDWhether the hook is valid or not. Once INVALID (following unsuccessful retries) the hook must be disabled and re-enabled.string
Returned values: An
EventType listed in the event types listThe type of the event.string
Max length: 128 characters (see data formats for details)The unique identifier of the object.
string
Max. length: 255 charactersCustom data that you can add to this object.
Unix timestamp
The date and time at which the object was created.
400 - Hook already exists for this EventType
400 - Hook already exists for this EventType
{
"Message": "One or several required parameters are missing or incorrect. An incorrect resource ID also raises this kind of error.",
"Type": "param_error",
"Id": "829f2782-85a9-45b1-a2bd-993b0978c5bc",
"Date": 1690295313.0,
"errors": {
"EventType": "A hook has already been registered for this EventType"
}
}
{
"Url": "https://example.com",
"Status": "ENABLED",
"Validity": "VALID",
"EventType": "PAYIN_REFUND_SUCCEEDED",
"Id": "hook_m_01J8F5RK4R43AYWD8XVG9RSYDT",
"Tag": "Created using the Mangopay API Postman Collection",
"CreationDate": 1727086218
}
{
"Url": "https://example.com",
"EventType" : "PAYIN_REFUND_SUCCEEDED",
"Tag": "Created using the Mangopay API Postman Collection"
}
<?php
require_once 'vendor/autoload.php';
use MangoPay\MangoPayApi;
use MangoPay\Libraries\ResponseException as MGPResponseException;
use MangoPay\Libraries\Exception as MGPException;
$api = new MangoPayApi();
$api->Config->ClientId = 'your-client-id';
$api->Config->ClientPassword = 'your-api-key';
$api->Config->TemporaryFolder = 'tmp/';
try {
$hook = new \MangoPay\Hook();
$hook->EventType = \MangoPay\EventType::MandateFailed;
$hook->Url = 'http://example.com';
$hook->Tag = 'Created using Mangopay PHP SDK';
$response = $api->Hooks->Create($hook);
print_r($response);
} catch(MGPResponseException $e) {
print_r($e);
} catch(MGPException $e) {
print_r($e);
}
const mangopayInstance = require('mangopay4-nodejs-sdk')
const mangopay = new mangopayInstance({
clientId: 'your-client-id',
clientApiKey: 'your-api-key',
})
let myHook = {
EventType: 'TRANSFER_SETTLEMENT_CREATED',
Url: 'http://example.com',
Tag: 'Created using Mangopay NodeJS SDK',
}
const createHook = async (hook) => {
return await mangopay.Hooks.create(hook)
.then((response) => {
console.info(response)
return response
})
.catch((err) => {
console.log(err)
return false
})
}
createHook(myHook)
require 'mangopay'
MangoPay.configure do |client|
client.preproduction = true
client.client_id = 'your-client-id'
client.client_apiKey = 'your-api-key'
client.log_file = File.join(Dir.pwd, 'mangopay.log')
end
def createHook(hookObject)
begin
response = MangoPay::Hook.create(hookObject)
puts response
return response
rescue MangoPay::ResponseError => error
puts "Failed to create Hook: #{error.message}"
puts "Error details: #{error.details}"
return false
end
end
myHook = {
EventType: 'PAYOUT_NORMAL_SUCCEEDED',
Url: 'http://example.com',
Tag: 'Created using Mangopay Ruby SDK'
}
createHook(myHook)
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mangopay.MangoPayApi;
import com.mangopay.core.enumerations.EventType;
import com.mangopay.entities.Hook;
public class CreateHook {
public static void main(String[] args) throws Exception {
MangoPayApi mangopay = new MangoPayApi();
mangopay.getConfig().setClientId("your-client-id");
mangopay.getConfig().setClientPassword("your-api-key");
Hook hook = new Hook();
hook.setEventType(EventType.USER_KYC_LIGHT);
hook.setUrl("http://example.com");
hook.setTag("Create using the Mangopay Java SDK");
Hook createHook = mangopay.getHookApi().create(hook);
Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create();
String prettyJson = prettyPrint.toJson(createHook);
System.out.println(prettyJson);
}
}
from pprint import pprint
import mangopay
mangopay.client_id='your-client-id'
mangopay.apikey='your-api-key'
from mangopay.api import APIRequest
handler = APIRequest(sandbox=True)
from mangopay.resources import Notification
hook = Notification(
event_type = 'USER_KYC_REGULAR',
url = 'http://example.com',
tag = 'Create using the Mangopay Python SDK'
)
create_hook = hook.save()
pprint(create_hook)
using MangoPay.SDK;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities.POST;
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
MangoPayApi api = new MangoPayApi();
api.Config.ClientId = "your-client-id";
api.Config.ClientPassword = "your-api-key";
var eventType = EventType.DISPUTE_CREATED;
var url = "https://www.example.com/";
var hook = new HookPostDTO(url, eventType) {
Tag = "Created using the Mangopay .NET SDK"
};
var createHook = await api.Hooks.CreateAsync(hook);
string prettyPrint = JsonConvert.SerializeObject(createHook, Formatting.Indented);
Console.WriteLine(prettyPrint);
}
}
Was this page helpful?
⌘I