• Resolved peter_l_p

    (@peterlarsenpan)


    hey support team,

    with the deprecated paypal standard method in paypal, i was able to filter the “invoice number” using such a php filter:

    add_filter( 'woocommerce_paypal_args', function( $args, $order ) {
    	$args[ 'invoice' ] = get_my_invoice_number( $order );
    	return $args
    }, 10, 2 );

    How is something like this possible with “PayPal Payments”?

    I’ve tried to use the hook “ppcp_create_order_request_body_data”, but I would need the “$order”-object as a parameter or the order_id within the $data-parameter. And I neither know to modify the “$data”-parameter to change the invoice_number. Changing the “reference_id” in “purchase_units” didn’t work and there is no existing “invoice_number” or something like this in the $data-parameter.

    Do you guys have a hint, please? Or a solution?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Syde Niklas

    (@niklasinpsyde)

    Hi @peterlarsenpan

    The payment process with PayPal Payments is more complex compared to PayPal Standard because it goes through multiple stages.
    But changing the invoice ID should still be possible.

    Could you please give it a try with something like this code example?

    It worked for me when I used this, for example:

    $order_number = $order->get_order_number();
    $custom_invoice_number = 'customprefix-' . $order_number;

    I hope this helps you out!

    Kind regards,
    Niklas

    Thread Starter peter_l_p

    (@peterlarsenpan)

    Hey Niklas,

    thanks a lot for your quick reply.
    It answers my question, the code snippet works great.
    Thank you very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘filter “invoice_number”’ is closed to new replies.