WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Custom payment gateway can't use after updated to 2.1.2 (7 posts)

  1. piggy811
    Member
    Posted 5 months ago #

    Hi,
    Two of my custom payment gateway can't use after updated to 2.1.2.
    Two of them are "direct" method. Is there any change regarding this file?

    I notice this apidocs was at old version:
    http://docs.woothemes.com/wc-apidocs/class-WC_Payment_Gateways.html

    Is there a new one?

    https://wordpress.org/plugins/woocommerce/

  2. mikejolley
    Member
    Plugin Author

    Posted 5 months ago #

    I'll get these regenerated shortly.

    For your gateway, check its not calling get_permalink inside - these urls need replacing with the new endpoints.

  3. piggy811
    Member
    Posted 5 months ago #

    Hi Mike,
    Thanks I checked and it sure has get_permalink.
    What should I replace it?
    i just try replaced it with get_checkout_payment_url( true ) but it does't work.
    Did I type wrong?
    Thanks!

  4. mikejolley
    Member
    Plugin Author

    Posted 5 months ago #

    If its a permalink to the pay page:

    $order->get_checkout_payment_url( true )
  5. piggy811
    Member
    Posted 5 months ago #

    I have one for thanks page:

    /**
    * Process the payment and return the result
    *
    * @access public
    * @param int $order_id
    * @return array
    */
    function process_payment($order_id) {
    global $woocommerce;
    $order = new WC_Order($order_id);

    // Empty awaiting payment session
    unset($_SESSION['order_awaiting_payment']);
    return array(
    'result' => 'success',
    'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(woocommerce_get_page_id('thanks'))))
    );
    }

    what will the code be like?

  6. Coen Jacobs
    Member
    Plugin Author

    Posted 5 months ago #

    That's wrong, it should use the method Mike mentioned. The thanks page is no longer a page, but is now an endpoint (and so is the pay page).

  7. piggy811
    Member
    Posted 5 months ago #

    Hi Coen & Mike,

    Thanks for the kind reply again.
    The problem was solved by replacing
    'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(woocommerce_get_page_id('thanks'))))

    to

    'redirect' => $this->get_return_url( $order )

    Thanks for the efforts to all develop team. Though the 2.1 version do have some adjustment, I think it's on the way to the best. And we are very impressive by the support while it's a free system :)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.