跳转到内容
Maple

Webhooks

Creates an endpoint that receives the `enabled_events` at `url`, rendered in `api_version` (the current version unless you name one).

此内容尚不支持你的语言。

POSThttps://api.maple.inc/v1/webhook_endpointsAPI key

Returns the HMAC signing secret once. A url Maple will not send to (not public HTTPS) answers 400 url_not_allowed.

Authorization

Send your API key as Authorization: Bearer <key>: mpk_test_… for test mode, mpk_live_… for live mode. Both use https://api.maple.inc/v1. See Authentication. The samples read the key from MAPLE_KEY and the base URL from MAPLE_BASE, as set up in the Quickstart.

Parameters

Request body

application/json, required.

  • url string required

  • enabled_events string[] required

  • api_version string

    The API version to render this endpoint’s events in, fixed for its life. Defaults to the current version; a version Maple does not serve answers 400 invalid_request.

Responses

200 OK

A webhook endpoint as its create call returns it, with its signing secret. created and updated are Unix timestamps in seconds.

  • object string required

    Always webhook_endpoint.

  • id string required

  • livemode boolean required

    True for an endpoint in the live environment; false for test mode.

  • url string required

    The HTTPS URL Maple sends events to.

  • api_version string required

    The API version this endpoint’s events are rendered in, a date (YYYY-MM-DD). Fixed when the endpoint is created.

  • enabled_events string[] required

    The event types Maple sends to url.

  • status string required

    One of enabled, disabled.

  • created integer required

  • updated integer required

  • secret string required

    HMAC-SHA256 signing secret (mwhsec_…) used to verify webhook deliveries. Only this response carries it: store it now.

Errors

  • 400 Bad request Invalid request (invalid_request_error), or idempotency_error for idempotency_key_mismatch

  • 401 Unauthorized Missing or invalid credential (authentication_error)

  • 403 Forbidden Not allowed (permission_error)

  • 409 Conflict Conflicts with current state (invalid_request_error), or idempotency_error for idempotency_key_in_use

  • 415 Unsupported Content-Type (invalid_request_error)

  • 429 Too many requests Rate limit reached (rate_limit_error)

  • 500 Server error Maple could not complete the request (api_error)

Every error body is one error object: branch on its type and code; message is for people, param names the field at fault, and doc_url links the code on Errors.

A 429 also sends Retry-After: Seconds to wait before retrying; also returned as error.retry_after in the body.