• Resolved monoarul

    (@monoarul)


    Hi, I am generating orders from custom form data for a specific product. My code is like this below.
    $name = sanitize_text_field( $_POST[‘name’] );
    $email = sanitize_text_field( $_POST[’email’] );
    $order_data = array(
    ‘first_name’ => $name,
    ’email’ => $email,
    );
    $order = wc_create_order();
    $order->set_address( $order_data );
    $order->add_product( wc_get_product( 10 ), 1 );
    $order->calculate_totals();

    Then I am doing -> echo $order->get_checkout_payment_url(); and its generating payment url like this https://24hwp.test/checkout/order-pay1/36/?pay_for_order=true&key=wc_order_MhkHhWje3ee980

    But clicking on that link showing this error “Sorry, this order is invalid and cannot be paid for.”

    Please help
    `

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Order pay link does not work’ is closed to new replies.