Skip to content

Reference Method

React More edited this page Jun 17, 2025 · 8 revisions

Webhook

Webhook provide a way for notifications to be delivered to an external web server whenever certain event occur in Mayar.

Get History

This endpoint give all data webhook from mayar

Parameter data:

Parameter Type Description Requirement Type
page integer ID of the user creating the board. Required
pageSize integer Desired name of the board being created. Required
startAt ISO Created at date
endAt ISO End date
status string Only two enum SUCCESS, FAILED
type string type webhook event
urlDestination string

Example Request

$mayarId->webhookServices()->getWebhookHistory(["pageSize" => 2]);

Response:

{
  "success": true,
  "message": "success",
  "data": [
    {
      "id": "6185704c-ade6-4a69-90bd-89978059f877",
      "createdAt": 1739461769775,
      "nextDelivery": null,
      "paymentLinkId": "3fb4a4ac-7ef2-49b0-8928-ccdc4b31374d",
      "payload": "{\"event\":\"payment.received\",\"data\":{\"id\":\"b44a09ff-aa85-43eb-982b-1b69982f79cd\",\"transactionId\":\"b44a09ff-aa85-43eb-982b-1b69982f79cd\",\"status\":\"SUCCESS\",\"transactionStatus\":\"paid\",\"createdAt\":\"2025-02-13T09:10:14.094Z\",\"updatedAt\":\"2025-02-13T09:10:14.094Z\",\"merchantId\":\"8f698b3f-1838-49f8-9dfd-3cbf8b526e71\",\"merchantName\":\"Reactmore\",\"merchantEmail\":\"reactmorecom@gmail.com\",\"customerName\":\"Andry Setyoso\",\"customerEmail\":\"andrysetyoso@gmail.com\",\"customerMobile\":\"0851550929223\",\"amount\":0,\"isAdminFeeBorneByCustomer\":null,\"isChannelFeeBorneByCustomer\":null,\"productId\":\"3fb4a4ac-7ef2-49b0-8928-ccdc4b31374d\",\"productName\":\"Demo Plugin\",\"productType\":\"saas\",\"pixelFbp\":null,\"pixelFbc\":null,\"couponUsed\":null,\"paymentMethod\":null,\"licenseCodes\":[{\"id\":\"feb655ff-8b14-4831-8fe2-7af332f22c73\",\"licenseCode\":\"3D0475E721E23B30\",\"createdAt\":\"2025-02-13T09:10:14.645Z\",\"updatedAt\":\"2025-02-13T09:10:14.743Z\"}]}}",
      "status": "SUCCESS",
      "type": "payment.received",
      "updatedAt": 1739461769775,
      "userId": "8f698b3f-1838-49f8-9dfd-3cbf8b526e71",
      "paymentLinkTransactionId": "b44a09ff-aa85-43eb-982b-1b69982f79cd",
      "urlDestination": "https://script.google.com/macros/s/xxxx/exec",
      "responsePayload": null,
      "source": "MANUAL"
    }
  ],
  "status_code": 200,
  "hasMore": true,
  "pageCount": 2,
  "pageSize": 10,
  "page": 1
}

Register URL Hook

Register your URL Hook for Webhook

Parameter data:

Parameter Type Description Requirement Type
urlHook string Valid URL register webhook event. Required

Example Request

$mayarId->webhookServices()->setWebhookURL('https://example.webhook.com');

Response

{
  "success": true,
  "message": "success",
  "data": null,
  "status_code": 200
}

Test URL Hook

Testing your URL Hook for Webhook

Parameter data:

Parameter Type Description Requirement Type
urlHook string Valid URL register webhook event. Required

Example Request

$mayarId->webhookServices()->setWebhookURL('https://example.webhook.com');

Response

{
  "success": true,
  "message": "success",
  "data": null,
  "status_code": 200
}

Retry History

Testing your URL Hook for Webhook

Parameter data:

Parameter Type Description Requirement Type
$webhookHistoryId string ID of webhook event. Required

Example Request

$mayarId->webhookServices()->retryWebhookURL('6185704c-ade6-4a69-90bd-89978059f877');

Response

{
  "success": true,
  "message": "success",
  "data": null,
  "status_code": 200
}

Request Payment

Make Request Payment.

Clone this wiki locally