Skip to Content
Menu
This question has been flagged
2199 Views

I have to create a payment by php xml-rpc  and assign to an invoice.

I'm able to create the payment and set it's state to 'posted', but I'm not able to reconcile that payment with an invoice.

$id_list = array();
 $id_list[]= new xmlrpcval($id, 'int'); //$id is the invoice_id

$dt = date("Y-m-d");
$data_payment = array (
'amount'=>new xmlrpcval('2', "double"),
'payment_date'=>new xmlrpcval($dt, "string"),
'payment_name'=>new xmlrpcval('Banca - Paypal', "string"),
'communication'=>new xmlrpcval('Banca - Paypal', "string"),
'journal_id'=>new xmlrpcval(7, "int"),
'invoice_ids'=>new xmlrpcval($id_list, "array"),
'has_invoices'=>new xmlrpcval(1, "boolean"),
'payment_method_id'=>new xmlrpcval(1, "int"),
'partner_id'=>new xmlrpcval(1624, "int"),
'partner_type'=>new xmlrpcval('customer', "string"),
'state'=>new xmlrpcval('draft', "string"),
'payment_type'=>new xmlrpcval('inbound', "string"));

$msg = new xmlrpcmsg('execute');
$msg->addParam(new xmlrpcval($dbname, "string"));
$msg->addParam(new xmlrpcval($uid, "int"));
$msg->addParam(new xmlrpcval($password, "string"));
$msg->addParam(new xmlrpcval("account.payment", "string"));
$msg->addParam(new xmlrpcval("create", "string"));
$msg->addParam(new xmlrpcval($data_payment, "struct"));
$response = $client->send($msg);

Avatar
Discard