Support

Home Forums Event Espresso Premium Custom payment method problem (2)

Custom payment method problem (2)

Posted: May 1, 2015 at 12:07 am

Viewing 3 reply threads


Anton Tarejev

May 1, 2015 at 12:07 am

Hello, we wrote this post on community forum but didn’t get answer. We created custom offsite payment method. It’s working only when user return on the website after payment, but if user payed and didn’t return to the website then payment and transaction status is abandoned. After payment payment gateway successfully 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 in handle_payment_update method. I hope you can give me right direction. Developer manual https://developers.paysera.com/en/payments/current#integration-via-library. 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()));
        }
    }
  • This topic was modified 9 years, 6 months ago by Anton Tarejev.
  • This topic was modified 4 years, 8 months ago by Garth.


Josh

  • Support Staff

May 1, 2015 at 8:02 am

Hi Anton,

I can advise looking through the PayPal_Standard gateway and how it interacts with SPCO. It updates the transaction after so many minutes if the payer doesn’t return to the site by means of a wp cron, which is exactly what you’re looking to do.

If you require further help, please open an issue on the main Event Espresso Github issue page and one of the developers can answer your specific questions there.


Anton Tarejev

May 1, 2015 at 8:55 am

Thank you


Josh

  • Support Staff

May 1, 2015 at 9:02 am

You’re welcome.

Viewing 3 reply threads

The support post ‘Custom payment method problem (2)’ 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