ci-merchant

ci-merchant purchase method not working properly


When I invoke this method. after that not statement executes.

$this->load->spark('ci-merchant/2.1.1'); # We always specify the full path from the spark folder $this->load->library('merchant'); $this->merchant->load('merchant_paypal_express');

             $settings = $this->merchant->default_settings();

                $settings = array(
                'username' => 'xxxxxxx',
                'password' => 'xxx',
                'signature' => 'xxxxxx',
                'test_mode' => true);
                $this->merchant->initialize($settings);
            // GETING AMOUNT REMAINING.    
                $params = array(
                'amount' => 100.00,
                'currency' => 'USD',
                'return_url' => 'hbs.local/checkout/payment_return',
                'cancel_url' => 'hbs.local/checkout/place_order');
                                    $response = $this->merchant->purchase($params);
                $message = $response->message();

Solution

  • Due to invalid account credientials I was getting the error. I was setting live account API credentials in $settings. using sandbox account setting solve my issue.