· 7 years ago · Apr 22, 2018, 09:02 AM
1public function stripepay()
2{
3// some post variables
4try {
5require_once APPPATH."third_party/stripe/init.php";
6//set api key
7$stripe = array(
8"secret_key" => "sk_test_gSev8A4OJf0F3BXXXXXXXX",
9"publishable_key" => "pk_test_XZZxorO1rYsZTJXXXXXXXX"
10);
11StripeStripe::setApiKey($stripe['secret_key']);
12// some more code
13}catch ( StripeErrorBase $e )
14{
15// Code to do something with the $e exception object when an error occurs.
16$body = $e->getJsonBody();
17$err = $body['error'];
18$data['failure_response'] = $err;
19$data['response_status'] = $e->getHttpStatus();
20$where = array('id' => $this->session->userdata('id'));
21$payment_info = $this->baseM->getOneRowData('users', $where);
22// this redirct is not working
23//redirect('service/failure_402'.$data);
24}
25}
26When it enters into this catch block I am trying to redirect to failue402 view.
27
28public function failure_402($data)
29{
30$where = array('id' => $this->session->userdata('id'));
31$payment_info = $this->baseM->getOneRowData('users', $where);
32$this->load->view('page_layout/header', $data);
33$this->load->view('service/failure_402',$data);
34$this->load->view('page_layout/footer', $data);
35}
36
37In the above stripePay() function
38// this redirect is not working
39redirect('service/failure_402'.$data);
40is not working.