Title: Problem with a Custom Payment Plugin
Last modified: April 26, 2022

---

# Problem with a Custom Payment Plugin

 *  [José Mundarain](https://wordpress.org/support/users/jemundarain/)
 * (@jemundarain)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/problem-with-a-custom-payment-plugin/)
 * I have creating a custom payment plugin for collect payments through your own
   bank. My problem is that, when enter in description booking page ([https://hotelrosabela.com/your-booking-detail/?sid=709901819&ts=1650994341](https://hotelrosabela.com/your-booking-detail/?sid=709901819&ts=1650994341)),
   the results is a WordPress Critical Error. What can be the solution?

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [e4jvikwp](https://wordpress.org/support/users/e4jvikwp/)
 * (@e4jvikwp)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/problem-with-a-custom-payment-plugin/#post-15595328)
 * Hello José,
 * Thanks for your message. A WordPress Critical Error is a generic error message
   displayed when the debug mode is turned off, otherwise the full server error 
   would have been displayed.
 * The first thing we suggest doing is to turn on the debug mode to see what’s actually
   causing the “Critical Error”. For sure the custom payment plugin you created 
   is declaring or extending invalid classes, or it’s doing something wrongly. If
   you are developing a custom payment plugin, then the debug mode should be enabled
   in your WordPress configuration, or you won’t be able to detect any potential
   conflict with what you are coding.
 * Once your website will start showing the full error message (either on screen
   or on the log file), you should act accordingly to fix the errors reported.
 * We hope this helps!
 * The VikWP Team
 *  Thread Starter [José Mundarain](https://wordpress.org/support/users/jemundarain/)
 * (@jemundarain)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/problem-with-a-custom-payment-plugin/#post-15596769)
 * Hello! Thank you for answering so quickly, I include fragments of the .log
 * PHP Warning: session_start(): Cannot start session when headers already sent 
   in …/httpdocs/wp-content/plugins/vikbooking/libraries/adapter/session/handler.
   php on line 31
 * PHP Notice: Undefined offset: 0 in /var/www/vhosts/hotelrosabela.com/httpdocs/
   wp-includes/capabilities.php on line 218
 * PHP Fatal error: Uncaught Error: Using $this when not in object context in /var/
   www/vhosts/hotelrosabela.com/httpdocs/wp-content/plugins/vikbdv/vikbooking/mypay.
   php:47
 * That error references this line
    $txname = $this->get(‘sid’) . ‘-‘ . $this->get(‘
   oid’) . ‘.tx’;
 *  Plugin Author [e4jvikwp](https://wordpress.org/support/users/e4jvikwp/)
 * (@e4jvikwp)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/problem-with-a-custom-payment-plugin/#post-15596838)
 * Hi,
 * Thanks for sharing the error message. The problem is that the line of code highlighted
   as responsible of the Fatal Error is code you wrote on your own, because the 
   plugin responsible is “vikbdv”, not Vik Booking, it’s the custom payment plugin
   you are developing.
 * Given the description of the error message, you are using $this outside a class
   method, maybe you are inside a function to be passed as a callback to a custom
   hook needed by Vik Booking? The technical documentation on our website that shows
   how to create a custom payment plugin is using `$payment` to access the “->get()”
   method, not `$this`.
 * You should review the code of your custom plugin because it is not working in
   the way it is right now.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Problem with a Custom Payment Plugin’ is closed to new replies.

 * ![](https://ps.w.org/vikbooking/assets/icon-256x256.png?rev=1855707)
 * [VikBooking Hotel Booking Engine & PMS](https://wordpress.org/plugins/vikbooking/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/vikbooking/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/vikbooking/)
 * [Active Topics](https://wordpress.org/support/plugin/vikbooking/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/vikbooking/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/vikbooking/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [e4jvikwp](https://wordpress.org/support/users/e4jvikwp/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/problem-with-a-custom-payment-plugin/#post-15596838)
 * Status: not resolved