Embedded merchant onboarding

Use embedded onboarding if your platform hosts shops and each merchant needs their own MeSomb account. Your server registers the shop, the merchant approves collections in MeSomb, and your platform collects payments for that shop.

Before you start

Ask MeSomb for an Integration Client with both merchants:onboard and merchants:collect permissions. Configure a public HTTPS webhook URL for that client. Start with a Sandbox client to test the full flow.

Send your Integration Client key in the X-API-Key header from your server. Keep it out of browsers and mobile apps. The client configuration determines whether requests use Live or Sandbox. The API base URL is https://api.mesomb.com.

Register a shop

Use a stable shop ID from your platform.

<span><span style="color: var(--shiki-color-text)">curl https://api.mesomb.com/integrations/v1/merchants/shops/ \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;X-API-Key: $MESOMB_INTEGRATION_KEY&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;Content-Type: application/json&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  --data </span><span style="color: var(--shiki-token-string-expression)">&#39;{&quot;shop_id&quot;:&quot;shop-42&quot;,&quot;shop_name&quot;:&quot;Example Store&quot;,&quot;email&quot;:&quot;merchant@example.com&quot;}&#39;</span></span>
<span></span>

Response · HTTP 201

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;7a1d978b-1d4e-47d8-b67c-d7aad0dd6d45&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;shop_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;shop-42&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;status&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;pending&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;environment&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;sandbox&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;verification_url&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;https://business.mesomb.com/merchant-onboarding#EXAMPLE_SIGNED_TOKEN&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;expires_at&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;2026-12-10T18:30:00Z&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Save the response ID as the MeSomb shop registration ID. Store it alongside your own shop ID and the environment. Share the private verification URL with the intended merchant. The first request returns HTTP 201. A retry with the same shop ID, name and email returns HTTP 200 and the same registration. Changing the details for that shop ID returns HTTP 409. Pending links expire after seven days. An identical retry renews an expired pending link.

MeSomb prepares a pending account if the email is new. The merchant sets a password through MeSomb or signs in to their existing account. They verify their email and business profile, accept the current terms, and approve with a fresh authenticator code. MeSomb creates a merchant-owned application for the shop. Live application limits apply, and the merchant can revoke the collection grant.

Check whether the shop is ready

Use the saved registration ID to check whether the merchant approved collections. You can also wait for the signed readiness webhook.

<span><span style="color: var(--shiki-color-text)">SHOP_REGISTRATION_ID=</span><span style="color: var(--shiki-token-string-expression)">&quot;7a1d978b-1d4e-47d8-b67c-d7aad0dd6d45&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">curl </span><span style="color: var(--shiki-token-string-expression)">&quot;https://api.mesomb.com/integrations/v1/merchants/shops/$SHOP_REGISTRATION_ID/&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;X-API-Key: $MESOMB_INTEGRATION_KEY&quot;</span></span>
<span></span>

Response · HTTP 200

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;7a1d978b-1d4e-47d8-b67c-d7aad0dd6d45&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;shop_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;shop-42&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;status&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;ready&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;environment&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;sandbox&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
Shop statusWhat your platform should do
pendingWait for merchant approval and keep payments disabled.
readyEnable checkout for this shop in the returned environment.
expiredRepeat the registration with the original details to obtain a new link.
revokedDisable checkout for this shop.

The status lookup omits the verification URL. To retrieve a pending link, repeat the registration request with the same details.

Collect a payment

Use the MeSomb registration ID in the URL. Assign one idempotency key to each payment attempt and keep the same key and body when retrying it.

<span><span style="color: var(--shiki-color-text)">curl </span><span style="color: var(--shiki-token-string-expression)">&quot;https://api.mesomb.com/integrations/v1/merchants/shops/$SHOP_REGISTRATION_ID/collect/&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;X-API-Key: $MESOMB_INTEGRATION_KEY&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;Idempotency-Key: order-123-attempt-1&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;Content-Type: application/json&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  --data </span><span style="color: var(--shiki-token-string-expression)">&#39;{&quot;amount&quot;:&quot;1000.00&quot;,&quot;currency&quot;:&quot;XAF&quot;,&quot;country&quot;:&quot;CM&quot;,&quot;payer&quot;:&quot;600000001&quot;,&quot;service&quot;:&quot;MTN&quot;}&#39;</span></span>
<span></span>

The example uses an MTN Sandbox test number. Use the customer’s real number in Live. The endpoint also supports Orange. Successful collections are credited to the merchant’s linked application. The platform’s grant permits collections only.

Response · HTTP 200

Here is an example of a collection awaiting confirmation. The successful Sandbox test number above normally returns success immediately.

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;6a20a57a-9a1b-4aad-aa4d-28e82fb742d8&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;status&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;PENDING&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;success&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">false</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;message&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;The payment is awaiting confirmation. Check its status before retrying.&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;message_code&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">null</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Save the payment ID against the order and keep the original idempotency key. The payment ID can be null when the response does not identify an admitted transaction. In that case you cannot use the status URL for this response.

Confirm the payment outcome

Save the payment ID returned by the collection request. If the status is pending, leave the order unpaid and use the status endpoint or wait for the signed outcome webhook. Mark the order paid only on confirmed success.

<span><span style="color: var(--shiki-color-text)">PAYMENT_ID=</span><span style="color: var(--shiki-token-string-expression)">&quot;6a20a57a-9a1b-4aad-aa4d-28e82fb742d8&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">curl </span><span style="color: var(--shiki-token-string-expression)">&quot;https://api.mesomb.com/integrations/v1/merchants/shops/$SHOP_REGISTRATION_ID/collections/$PAYMENT_ID/&quot;</span><span style="color: var(--shiki-color-text)"> \</span></span>
<span><span style="color: var(--shiki-color-text)">  -H </span><span style="color: var(--shiki-token-string-expression)">&quot;X-API-Key: $MESOMB_INTEGRATION_KEY&quot;</span></span>
<span></span>

Response · HTTP 200

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;6a20a57a-9a1b-4aad-aa4d-28e82fb742d8&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;status&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;SUCCESS&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;success&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">true</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;message&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;The payment has been successfully done!&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;message_code&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">null</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>
Payment statusWhat your platform should do
PENDINGKeep the order awaiting payment. Poll with a delay or wait for the outcome webhook.
SUCCESSMark the matching order paid once.
FAILTreat the collection as unsuccessful or reversed. Update the order accordingly.

Use the status field to distinguish a pending payment from a failure. Both can return HTTP 200 with a false success flag.

The lookup returns the current payment status. It requires an active grant for that shop and the same Integration Client and environment. An idempotent replay of the collection request returns its original response, which can still report a pending status. Outcome tracking applies to collections admitted after the feature was enabled.

Receive signed webhooks

MeSomb sends both events to the HTTPS URL configured for your Integration Client.

EventWhen it is sentWhat to save
merchant.readyAfter the merchant approves collections.The event ID is also the MeSomb shop registration ID.
merchant.collection.outcomeWhen MeSomb first observes a final collection outcome.Match the collection ID and shop registration ID to the order.

Readiness event

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;7a1d978b-1d4e-47d8-b67c-d7aad0dd6d45&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;type&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;merchant.ready&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;shop_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;shop-42&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;environment&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;sandbox&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;occurred_at&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;2026-12-03T18:00:00Z&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Collection outcome event

The readiness payload includes the external shop ID, environment and approval time. The collection outcome adds the payment ID, final status and success flag. Verify that the environment matches your order before applying the event.

<span><span style="color: var(--shiki-color-text)">{</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;b02ae10d-470f-4751-8398-4d888906ac52&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;type&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;merchant.collection.outcome&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;shop_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;shop-42&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;shop_registration_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;7a1d978b-1d4e-47d8-b67c-d7aad0dd6d45&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;collection_id&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;6a20a57a-9a1b-4aad-aa4d-28e82fb742d8&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;environment&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;sandbox&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;status&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;SUCCESS&quot;</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;success&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-constant)">true</span><span style="color: var(--shiki-token-punctuation)">,</span></span>
<span><span style="color: var(--shiki-color-text)">  </span><span style="color: var(--shiki-token-keyword)">&quot;occurred_at&quot;</span><span style="color: var(--shiki-token-punctuation)">:</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-string-expression)">&quot;2026-12-03T18:30:00Z&quot;</span></span>
<span><span style="color: var(--shiki-color-text)">}</span></span>
<span></span>

Verify the signature against the raw request body before parsing it. Reject timestamps outside your replay window. Derive the signing key by computing HMAC-SHA256 over the UTF-8 string mesomb.merchant.ready.v1, using the raw SHA-256 digest of the Integration Client key as the HMAC key. Then compute HMAC-SHA256 over the timestamp header, a period and the raw body. Compare the lowercase hexadecimal signature in constant time. Update your verifier when you rotate the integration key.

<span><span style="color: var(--shiki-token-keyword)">import</span><span style="color: var(--shiki-color-text)"> hashlib</span></span>
<span><span style="color: var(--shiki-token-keyword)">import</span><span style="color: var(--shiki-color-text)"> hmac</span></span>
<span></span>
<span><span style="color: var(--shiki-token-keyword)">def</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-function)">verify_merchant_event</span><span style="color: var(--shiki-color-text)">(</span><span style="color: var(--shiki-token-parameter)">api_key</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-parameter)">timestamp</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-parameter)">signature</span><span style="color: var(--shiki-token-punctuation)">,</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-parameter)">raw_body</span><span style="color: var(--shiki-color-text)">):</span></span>
<span><span style="color: var(--shiki-color-text)">    key_digest </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> hashlib</span><span style="color: var(--shiki-token-punctuation)">.</span><span style="color: var(--shiki-token-function)">sha256</span><span style="color: var(--shiki-token-punctuation)">(api_key.</span><span style="color: var(--shiki-token-function)">encode</span><span style="color: var(--shiki-token-punctuation)">(</span><span style="color: var(--shiki-token-string-expression)">&quot;utf-8&quot;</span><span style="color: var(--shiki-token-punctuation)">)).</span><span style="color: var(--shiki-token-function)">digest</span><span style="color: var(--shiki-token-punctuation)">()</span></span>
<span><span style="color: var(--shiki-color-text)">    signing_key </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> hmac</span><span style="color: var(--shiki-token-punctuation)">.</span><span style="color: var(--shiki-token-function)">digest</span><span style="color: var(--shiki-token-punctuation)">(key_digest, </span><span style="color: var(--shiki-token-keyword)">b</span><span style="color: var(--shiki-token-string-expression)">&quot;mesomb.merchant.ready.v1&quot;</span><span style="color: var(--shiki-token-punctuation)">, </span><span style="color: var(--shiki-token-string-expression)">&quot;sha256&quot;</span><span style="color: var(--shiki-token-punctuation)">)</span></span>
<span><span style="color: var(--shiki-color-text)">    signed </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> timestamp</span><span style="color: var(--shiki-token-punctuation)">.</span><span style="color: var(--shiki-token-function)">encode</span><span style="color: var(--shiki-token-punctuation)">(</span><span style="color: var(--shiki-token-string-expression)">&quot;ascii&quot;</span><span style="color: var(--shiki-token-punctuation)">)</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-keyword)">+</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-keyword)">b</span><span style="color: var(--shiki-token-string-expression)">&quot;.&quot;</span><span style="color: var(--shiki-color-text)"> </span><span style="color: var(--shiki-token-keyword)">+</span><span style="color: var(--shiki-color-text)"> raw_body</span></span>
<span><span style="color: var(--shiki-color-text)">    expected </span><span style="color: var(--shiki-token-keyword)">=</span><span style="color: var(--shiki-color-text)"> hmac</span><span style="color: var(--shiki-token-punctuation)">.</span><span style="color: var(--shiki-token-function)">new</span><span style="color: var(--shiki-token-punctuation)">(signing_key, signed, hashlib.sha256).</span><span style="color: var(--shiki-token-function)">hexdigest</span><span style="color: var(--shiki-token-punctuation)">()</span></span>
<span><span style="color: var(--shiki-color-text)">    </span><span style="color: var(--shiki-token-keyword)">return</span><span style="color: var(--shiki-color-text)"> hmac</span><span style="color: var(--shiki-token-punctuation)">.</span><span style="color: var(--shiki-token-function)">compare_digest</span><span style="color: var(--shiki-token-punctuation)">(expected, signature)</span></span>
<span></span>
<span><span style="color: var(--shiki-token-comment)"># Pass the validated X-MeSomb-Webhook-Timestamp and</span></span>
<span><span style="color: var(--shiki-token-comment)"># X-MeSomb-Webhook-Signature header values.</span></span>
<span></span>

Deduplicate deliveries by event ID and return HTTP 2xx after saving the result. Retries carry the same event ID and body. Use the status endpoint for the latest result if a payment is later corrected or reversed.