Register a webhook

Hi guys,
I need to register a webhook to receive notification about subscription updates that a user can do on my App installed on the Poynt terminal.

Reading at the documentation here I understood that to register the webhook I need a Poynt issued application JWT to use it as bearer access token for the registration call.

To get the Poynt issued application JWT I need to create the self signed JWT and POST it to /token.

I tried to create my self signed JWT but when POST to /token I receive this error answer:

Could not find application issuer

The application issuer is my App ID in the form

urn:aid:97768f67-6401-xxxx-xxxx-xxxxxxxxxxxx

Why can not find the app issuer?

My app is a .dev variant App in the eu.poynt.net portal

BTW: is there a more easy way to register a webhook? It’s a one time operation

Many thanks

Can you please check if the url you are using is EU (https://services-eu.poynt.net/hooks), if it does not work when using the eu endpoint please send a request to devsupport@poynt.co with your request Id.

Ok the right one was https://services-eu.poynt.net/token

Now I’m been able to register a webhook associated with Event types supported for Billing as described here .

The call to the webhook registration returns this

[active] => 1
[createdAt] => 2018-11-22T15:11:40Z
[updatedAt] => 2018-11-22T15:11:40Z
[eventTypes] => Array
    (
        [0] => APPLICATION_SUBSCRIPTION_START
        [1] => APPLICATION_SUBSCRIPTION_END
        [2] => APPLICATION_SUBSCRIPTION_PAYMENT_SUCCESS
        [3] => APPLICATION_SUBSCRIPTION_PAYMENT_FAIL
        [4] => APPLICATION_SUBSCRIPTION_PHASE_CHANGE
        [5] => APPLICATION_SUBSCRIPTION_REFUND_SUCCESS
    )

[id] => b719288b-c1c0-xxxx-xxxx-xxxxxxxxxxxx
[applicationId] => urn:aid:97768f67-6401-xxxx-xxxx-xxxxxxxxxxxx
[secret] => ********
[deliveryUrl] => https://api.developer.mydomain.com/poynt/?action=webhook
[businessId] => bb32516b-a2e2-xxxx-xxxx-xxxxxxxxxxxx

so I suppose it’s working.

Anyway, when with my App on the Poynt device I perform a subscription no call is done the the registered webhook.
What can be missing in the flow?

BTW if I try to purchase the same subscription with my App on the Poynt device I get I message saying that the product has already been purchased.

Please, which can be the problem? How can we debug this?

There is a way to check which webhook is associated with Event to be sure the webhook is correctly set?

Thanks

Can you try unsubscribing to the app from app store and subscribing to it again?
https://support.poynt.com/hc/en-us/articles/115012584367-How-do-I-cancel-or-unsubscribe-from-an-App-

Thank you.
Where can I find the Poynt Apps marketplace to try the unsubscribe?

@movylo You mean you don’t have the Poynt Store on your P6SW183JS001114 device?

@movylo @dennis confirmed, he doesn’t have Poynt Store on his device. Could you push it?

@dennis any update?
can you push the Poynt Store on the device?

@movylo, the app should be there now.

Ok I succeeded in uninstalling the App.
Now I’m able to try a new subscription.
Now running the Billing Fragment for the 0€ plan my App shows this:

but when I perform the payment it fails.

We can see this in the log if it can help:

12-05 16:02:59.960 1433-4115/? D/OkHttp: --> POST https://billing-eu.poynt.net/apps/com.movylo.poyntmovylo.dev/subscriptions http/1.1
12-05 16:03:00.176 1433-4115/? D/OkHttp: <-- 400 https://billing-eu.poynt.net/apps/com.movylo.poyntmovylo.dev/subscriptions (215ms)
12-05 16:03:00.222 4285-4285/com.movylo.poyntmovylo.dev D/Movylo-Billing: runBillingFragment: result canceled with resultCode ‘0’ and data: Intent { }

Can you help to understand the issue?

Thanks

Can you please try subscribing now. If the replace does not work try subscribing to a plan first before trying to replace.

Hi and thank you: I’m now able to be called at the webhook when a subscription event occurs.

I now receive data like this

{
“createdAt”: “2019-01-29T15:11:16Z”,
“updatedAt”: “2019-01-29T15:11:16Z”,
“links”: [{
“href”: “https://billing.poynt.net/apps/urn:aid:97768f67-6401-4f7e-99fc-0bd4b88fe04c/subscriptions/c09de6fb-1b77-4b41-9898-81f95d0eed83”,
“rel”: “resource”,
“method”: “GET”
}],
“id”: “c0e1190f-65b4-4be9-982a-39804edec5ae”,
“hookId”: “890f29de-d51d-4572-b885-bb809ae19e00”,
“applicationId”: “urn:aid:97768f67-6401-4f7e-99fc-0bd4b88fe04c”,
“resource”: “/apps/subscriptions”,
“resourceId”: “c09de6fb-1b77-4b41-9898-81f95d0eed83”,
“eventType”: “APPLICATION_SUBSCRIPTION_START”,
“merchantType”: “TEST_MERCHANT”,
“businessId”: “32cc36ff-55aa-42fe-9810-0a72a5d0071a”
}

but when I try to discover more subscription info calling

curl -X GET https://billing.poynt.net/apps/urn:aid:24c6e3d4-19e4-45c8-8231-6af2089dc694/subscriptions/5edfded9-49fb-464c-922e-cf662734055f83 -H ‘authorization: Bearer ValidAccessToken’ -H ‘cache-control: no-cache’ -H ‘content-type: application/json’

I always receive a 401 error

I’m using tokens generated from calling ‘https://services-eu.poynt.net/token

I also tried to call page at services-eu.poynt.net instead of billing.poynt.net but the page doesn’t exist.

My current token looks like this:

eyJhbGciOiJSUzI1NiJ9.eyJhdWQiOiJ1cm46YWlkOjk3NzY4ZjY3LTY0MDEtNGY3ZS05OWZjLTBiZDRiODhmZTA0YyIsInN1YiI6InVybjphaWQ6OTc3NjhmNjctNjQwMS00ZjdlLTk5ZmMtMGJkNGI4OGZlMDRjIiwicG95bnQuYXVyIjoiY29tLm1vdnlsby5wb3ludG1vdnlsby5kZXYiLCJwb3ludC5zY3QiOiJKIiwicG95bnQub3JnIjoiYmIzMjUxNmItYTJlMi00MzVkLWJmZTAtYzcxNDE5MWRiODNhIiwiaXNzIjoiaHR0cHM6XC9cL3NlcnZpY2VzLWV1LnBveW50Lm5ldCIsInBveW50LmtpZCI6NjE1NTI0NjE1MjgyNzE0MTc3NywicG95bnQuYXR5IjoiUyIsImV4cCI6MTU0ODg2MTE0MywiaWF0IjoxNTQ4Nzc0NzQzLCJqdGkiOiIzYWNmZjYwYy0yODI0LTQwYWMtYTQzYi1kMzNlNzU3NWFiNjUifQ.UUQl2OmtFYJCnUx7VbaHESmcrMXg8vOuvcLuS1VnDk-pFHcbTbVin_9ZgePJvnd6flwXkH-mO2kkAJRR84kYatw3yv-evbG_uR62CDPK6tQjXD36HQ9f3L1OgwJTUNdQHb-EpD8oxH5Ctk66MI2pAjRgQjzwZe6Xnhw1WPpew4D1fXgg6daz28lksxnGkqQyhaAb8og1Au01JA7MpjwOPNzOpq9Sy9f8bu0zYktL2hddWjiYlmD39i1k9IU5zgaGO3dg96ViSj2rR8va_B4z-hwoKTQPQ0UTgAGG8FXqCIU-9dafziZDNM3G8wROI2TvWbEEK95Y4mQFuNv-Dkk7Nw

Do I have to differently generate the token? How?

Many thanks,
Alessandro

Hi Alessandro,
Please change the URL to use https://billing-eu.poynt.net
so it would be https://billing-eu.poynt.net/apps/urn:aid:97768f67-6401-4f7e-99fc-0bd4b88fe04c/subscriptions/c09de6fb-1b77-4b41-9898-81f95d0eed83
We will make sure this is fixed in the next couple of weeks.

Best,
Deepak

Ok thank you, it works now