Problem with custom payment method



  • Hi, I tried to make a custom payment method exactly on paypal.
    I copied the files from paypal and tried to change the links to the sandbox as in this documentation.

    public function getRedirectUrl($params = [])
        {
            return sprintf('http://sandboxsecure.mobilpay.ro',
                $this->getConfigData('sandbox') ? 'sandbox.' : '',
                $params ? '?' . http_build_query($params) : ''
            );
        }
    

    IPN

    protected function postBack()
        {
            if (array_key_exists('test_ipn', $this->post) && 1 === (int) $this->post['test_ipn']) {
                $url = 'http://sandboxsecure.mobilpay.ro';
            } else {
                $url = '';
            }
    
            $request = curl_init();
    
            curl_setopt_array($request, [
                CURLOPT_URL            => $url,
                CURLOPT_POST           => TRUE,
                CURLOPT_POSTFIELDS     => http_build_query(array('cmd' => '_notify-validate') + $this->post),
                CURLOPT_RETURNTRANSFER => TRUE,
                CURLOPT_HEADER         => FALSE,
            ]);
    
            $response = curl_exec($request);
            $status = curl_getinfo($request, CURLINFO_HTTP_CODE);
    
            curl_close($request);
    
            if ($status == 200 && $response == 'VERIFIED') {
                return true;
            }
    
            return false;
        }
    

    https://github.com/mobilpay/composer
    This is the documentation.
    My question is, how exactly could I make this work and be redirected properly?
    Can I make this method concrete or should I take a payment method to change it?
    What do you think and if you could give me some advice on how I could proceed




Log in to reply