I’m trying to register a custom webhook (using a sandbox environment) and getting a permissions error. Would appreciate some help!
The OAuth connection is established with the following scopes:
ITEMS_READ MERCHANT_PROFILE_READ PAYMENTS_WRITE_ADDITIONAL_RECIPIENTS PAYMENTS_WRITE PAYMENTS_READ DEVELOPER_APPLICATION_WEBHOOKS_WRITE
The request code is as follows:
const { webhookSubscriptionsApi } = new Client({
accessToken: util.types.toString(myConnection.token?.access_token),
environment: Environment.Sandbox
});
await webhookSubscriptionsApi.createWebhookSubscription({
idempotencyKey: uuidv4(),
subscription: {
name: 'Example Webhook Subscription',
eventTypes: [
'payment.created',
'payment.updated'
],
notificationUrl: <notification URL>,
apiVersion: '2021-12-15'
}
});
Below is a snippet of the response (I can provide the full responses if helpful):
{
"errors": [
{
"category": "AUTHENTICATION_ERROR",
"code": "INSUFFICIENT_SCOPES",
"detail": "The merchant has not given your application sufficient permissions to do that. The merchant must authorize your application for the following scopes: DEVELOPER_APPLICATION_WEBHOOKS_WRITE"
}
]
}