Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Problem with custom payment method

    General Discussion
    2
    2
    201
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User last edited by

      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

      1 Reply Last reply Reply Quote 0
      • V
        Vaishali Agarwal last edited by

        Dear @DaniD
        Hope this guide will help you https://devdocs.bagisto.com/1.x/advanced/create_payment_method.html

        1 Reply Last reply Reply Quote 0
        • First post
          Last post