XMLRPC Error
-
When I try the create invoice example i get the following errors:
Notice: Trying to get property ‘params’ of non-object in /var/www/html/wp-includes/IXR/class-IXR-client.php on line 155
Notice: Trying to access array offset on value of type null in /var/www/html/wp-includes/IXR/class-IXR-client.php on line 155
The example is on the documentation here:
https://wp-invoice.github.io/docs/api/#gsc.tab=0I am attempting to use the XMLRPC to create an invoice. I modified it a little to get it to work from a test page:
<?php //include_once( '../class-IXR.php' ); //include_once( '../class-wp-http-ixr-client.php' ); //Load WordPress include_once( '../wp-load.php' ); include_once( '../wp-includes/class-IXR.php' ); include_once( '../wp-includes/class-wp-http-ixr-client.php' ); $client = new WP_HTTP_IXR_Client( 'https://{SITE}/xmlrpc.php' ); $client->query('wp.invoice', array( $method = 'create_invoice', $credentials = array('xmlrpc-user', 'password'), $args = array( 'subject' => 'Test API Invoice', 'description' => 'Invoice descriptive information.', 'type' => 'invoice', 'user_data' => array( 'user_email' => '[email protected]', 'first_name' => 'John', 'last_name' => 'Smith' ), 'deposit' => 15.99, 'due_date' => array( 'month' => '09', 'day' => '10', 'year' => '2013' ), 'currency' => 'USD', 'tax' => 10.5, 'tax_method' => 'after_discount', 'status' => 'active', 'discount' => array( 'name' => 'Your Discount', 'type' => 'amount', 'amount' => 1.20 ), 'items' => array( array( 'name' => 'Test item 1', 'description' => 'Item 1 description', 'quantity' => 2, 'price' => 2.65, 'tax_rate' => 1 //global 'tax' will be used in order to priority ), array( 'name' => 'Test item 2', 'description' => 'Item 2 description', 'quantity' => 4, 'price' => 3.85 ) ), 'charges' => array( array( 'name' => 'Fee 1', 'amount' => 0.56 ), array( 'name' => 'Fee 2', 'amount' => 0.99, 'tax' => 15 //global 'tax' will be used in order to priority ) ) ) )); $new_invoice = $client->getResponse(); ?>
- The topic ‘XMLRPC Error’ is closed to new replies.