Skip to content
View in the app

A better way to browse. Learn more.

Loyverse Town

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Webhooks and Security for Pay-later payment method

Featured Replies

Hi,

I'm currently building a solution to add "Pay Later" functionality in Loyverse Pos. I'm using the service of Klarna In-Store for this, which is specifically designed for physical stores.  

My current solution works by adding a Klarna-payment method inside Loyverse. A receipts.update webhook triggers the integration with Klarna and creates a new payment-session with a copy of the receipt inside Klarna. A separate web interface allows to complete the payment method, by sending a form to the users phone (email/phone/QR). (They have to fill it in for credit-checks etc.) Also refund-receipts are synchronised to Klarna, so the customer only has to pay for what they keep. 

 

Now I want to validate the webhook for security, but it seems the mentioned headers are not sent currently.
Also the validation algorithm seems to be missing from the docs;

https://developer.loyverse.com/docs/#section/Webhooks-overview/Validate-notifications

 

Any information about this?

Webhook was created  by token created by Oauth2 authorization?

Edited by Jay Rock

  • Author
3 hours ago, Jay Rock said:

Webhook was created  by token created by Oauth2 authorization?

Hmm, I did not. I created it from the Loyverse dashboard  

That could be a difference indeed, I will test again. Thanks! 

Edited by Gemma

  • Author

I created the webhook using the api, authenticated with OAuth2 and it works now! Thanks again.

I was able to validate the webhook using the following PHP-function;

hash_hmac('sha1', $data, $key, false)

 

  • 3 months later...

Hey @Gemma, could you please instruct me how to set up webhook using the api, authenticated with OAuth2? I am struggling with setting up wedhooks. Thanks in advance.

  • Author

Did u check this
https://developer.loyverse.com/docs/#tag/Webhooks/paths/~1webhooks~1/post

 

Code I'm using;


$webhook = array(
        'url' => 'https://url/url.php',
        'type' => 'receipts.update',
        'status' => 'ENABLED',
);
$result = CallAPI('POST', 'https://api.loyverse.com/v1.0/webhooks/', json_encode($webhook), $token);

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.