php - Woocommerce API returns 1, but works -
i'm trying write own payment gateway woocommerce , it's going pretty well. payment provider can callback verify payment status, created callback function.
add_action('woocommerce_api_'.strtolower(get_class($this)), array(&$this, 'callback')); public function callback() { mail('my@email.com', 'callback ideal', print_r($_request,true) . print_r($_server,true)); echo '+'; return '+'; }
when call callback url, recieve email that's in callback function, output callback gives 1.
i did googling on 1 means, means callback doesn't end or isn't called @ all.
in case called, since recieve email. point me in right direction ? must missing something.
update:
when kill script exit in callback function, can see output. isn't appropriate solution
the reason might action been called via ajax. in wordpress ajax default returns die() function before function ends. if don't specify die() in our custom function append 1 data in our callback. have call die or exit after output being echo browser prevent returning , other data in our custom functions been called via ajax.
hope solution helps you.
Comments
Post a Comment