Events
Server Side Events
You can use our events url to subscribe to updates to your transaction. All you need is the transaction code from when you created the transaction and then subscribe to the status_update event.
Live
SSE https://events.fumopay.app/transaction/${code}
Test
SSE https://events.fumopay.dev/transaction/${code}
Response JSON
{
"transaction_id": "fumo transaction code",
"result": "11",
"error": "error description",
"url": "a fumopay url"
}
Example js code
var code = "test";
const eventSource = new EventSource(`https://events.fumopay.dev/transaction/${code}`);
eventSource.addEventListener('status_update', (e) => {
var resp = JSON.parse(d.data);
//Status is paid (11)
if (resp.result == "11"){
//do something such as redirect
window.location = resp.url
}
});