VivaPayments / API

Index of Viva Wallet open source projects on GitHub.
139 stars 163 forks source link

Help on testing webhooks #2419

Closed kristofthys closed 1 year ago

kristofthys commented 1 year ago

I am trying to integrate Viva with our existing platform, but I'm stuck on the webhook part.

Everything seems to work fine, I'm able to create orders and pay them, but I don't see a callback to my webhook.

Is there any documentation available on how to test these webhooks? I don't find a (PHP) code sample of the webhook implementation either. This could come in handy.

For now, my webhook code is quite simple:

public function vivawebhook(){
    $this->load->model('Vivaapi');
    if ($this->input->post()) {
        //it's a post
        $data = $this->input->post();
        $myfile = fopen("test.txt", "w") or die("Unable to open file!");
        $txt = print_r($data,true);
        fwrite($myfile, $txt);
        fclose($myfile);        
    } else {
        //it's a get
       echo $this->Vivaapi->getVivaToken();
    }  
  }

Where I try to dump the post-variables to a file. However, no file is created... Using postman, this function works fine, whatever I send using POST is dumped in a file...

Merchant ID: 19aabe4b-aaeb-4c50-a3fc-19c5b9a35822 Webhook URL: https://www.agito-labs.be/aps2/index.php/home/vivawebhook

Thanks for your advice Kristof

VivaWalletCustomerSupport commented 1 year ago

Hello @kristofthys,

Thank you for your message. Make sure your webhook is public; not private. Kindly note that you should not set any redirection from your webhook endpoints to other locations. Otherwise, you may encounter errors, and webhook notifications may not be received successfully.

Additional information regarding webhooks can be found in the link below: https://developer.vivawallet.com/webhooks-for-payments/

Kind regards, Viva Wallet E-commerce Support Team

kristofthys commented 1 year ago

Thanks for your response!

I have verified and if I understand correctly, my function is public and I'm not doing any redirects...

VivaWalletCustomerSupport commented 1 year ago

Hello @kristofthys,

Thank you for your prompt response. Your webhook URL generates the key which means we have identified your request as a merchant. We would recommend checking your implementation once again on how to handle the received notifications.

Kind regards, Viva Wallet E-commerce Support Team

kristofthys commented 1 year ago

Hi,

I'm a little bit disappointed.

Isn't there a code sample available on how to implement this webhook? The other documentation on the website, eg to create a payment order is very complete. Isn't it an idea to update the documentation with a small sample on how to process the input sent from Viva?

Thanks, Kristof

VivaWalletCustomerSupport commented 1 year ago

Hello @kristofthys,

Thank you for your suggestion. We always consider our customers' feedback for future improvements. We will review your request and possibly, it will be available in a future update.

Kind regards, Viva Wallet E-commerce Support Team

VivaWalletCustomerSupport commented 1 year ago

Hello @kristofthys,

This ticket will close for now. Please don't hesitate to raise a new ticket if you need further assistance.

Kind regards, Viva Wallet E-commerce Support Team

AdamMiltonBarker commented 1 year ago

Hi,

I'm a little bit disappointed.

Isn't there a code sample available on how to implement this webhook? The other documentation on the website, eg to create a payment order is very complete. Isn't it an idea to update the documentation with a small sample on how to process the input sent from Viva?

Thanks, Kristof

No, because they are 2 bob company who rather blame their customers for their bad documentation and implementation. Save yourself the hassle and use a reputable company.