// child obj
Invoice__c inv = New Invoice__c(CID__c='cus_Mc6cs07FHsB36K',Number__c='7B27EB1B-0026',isPaid__c=true,Status__c='Paid');
// parent obj
User userExtInv=New User(CID__c='cus_Mc6cs07FHsB36K'); // this record is on the CRM don't get this via SOQL
inv.Users = userExtInv; // child.toParentRelationship = parentRecordWithExtID
insert inv;
User object must have CID__c externalID field ( text )
User object must have a record cus_Mc6cs07FHsB36K on CID__c field.
Invoice__c must have lookup or master detail to User object.
Parent is User and Invoice__c is child object.
inv.Users = is a Relationship Name for custom objects use __r instead of s