Support

Home Forums Community Forum Custom payment method problem

Custom payment method problem

Posted: April 30, 2015 at 1:10 pm

Viewing 2 reply threads


Vasily

April 30, 2015 at 1:10 pm

Hello, I wrote custom offsite payment method. It’s working ok only when user return on website after payment, but appear problem when user payed and doesn’t return to the website. Payment is complete but transaction status is abandoned. Payment gateway visit callback url and got “Ok” message. How to change registration and transaction status if user doesn’t return back? How can I trigger update methods for registration and transaction status when payment gateway visit callback url and what are these update methods? I think main problem handle_payment_update method. I hope you can give me right direction. Thank you
code ex.

public function handle_payment_update($update_info, $transaction) {
        $payment = $transaction instanceof EEI_Transaction ? $transaction->last_payment() : NULL;
        
        if ($payment && $payment instanceof EEI_Payment) {
            $response = WebToPay::checkResponse($update_info, array(
                        'projectid' => $this->_projectid,
                        'sign_password' => $this->_password,
            ));

            if ($response['status'] == 0) {
                $payment->set_status($this->_pay_model->declined_status());
                $payment->set_gateway_response(__('Payment has no been executed', 'event_espresso'));
                $payment->set_txn_id_chq_nmbr($response['orderid'] . '/' . $response['requestid']);
            } elseif ($response['status'] == 1) {
                $payment->set_status($this->_pay_model->approved_status());
                $payment->set_gateway_response(__('Your payment is approved.', 'event_espresso'));
                $payment->set_txn_id_chq_nmbr($response['orderid'] . '/' . $response['requestid']);
            } else {
                $payment->set_gateway_response(__('Your payment has been declined.', 'event_espresso'));
                $payment->set_details($response);
                $payment->set_txn_id_chq_nmbr($response['orderid'] . '/' . $response['requestid']);
                $payment->set_status($this->_pay_model->declined_status()); 
            }

            if (isset($_REQUEST['ee_payment_method']) && $_REQUEST['ee_payment_method'] == 'paysera_payment_method') {
                @ob_clean();
                header('HTTP/1.1 200 OK');
                exit('OK');
            }

            return $payment;
        } else {
            throw new EE_Error(sprintf(__("Could not find payment for transaction %s", 'event_espresso'), $transaction->ID()));
        }
    }


Vasily

April 30, 2015 at 1:16 pm

Sorry I forgot to give a link to developer manual https://developers.paysera.com/en/payments/current#integration-via-library


Josh

  • Support Staff

May 5, 2015 at 7:45 am

moved to this Github issue:

https://github.com/eventespresso/event-espresso-core/issues/72

Viewing 2 reply threads

The support post ‘Custom payment method problem’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso