# Add vendor reference to SEPA payment xml

**URL:** <https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471>\
**Category:** CRM/SRM Modules\
**Created:** [March 30, 2021, 6:56am UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471 "2021-03-30T06:56:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Klaas](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/klaas/32/486_2.png) [@Klaas](https://www.dolibarr.org/forum/u/Klaas)\
**Post date:** [March 30, 2021, 6:56am UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/1 "2021-03-30T06:56:16Z")

</div>

Receivers of payments now receive payment with reference. This is the number of administration in Dolibarr.  
The receiver can not do anything with it. It needs HIS/HER invoice reference for correct administration!  
Is there a way we can add this to de XLM file?

---

<div class="post-metadata">

**Author:** ![Dolisupport.nl](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/dolisupport.nl/32/3564_2.png) [@Dolisupport.nl](https://www.dolibarr.org/forum/u/Dolisupport.nl)\
**Post date:** [April 4, 2021, 1:31pm UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/2 "2021-04-04T13:31:32Z")

</div>

Should be possible in parameter of code. Please, can you explain your working process. Hope I can help. Private message is also OK.  
Hans

---

<div class="post-metadata">

**Author:** ![Klaas](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/klaas/32/486_2.png) [@Klaas](https://www.dolibarr.org/forum/u/Klaas)\
**Post date:** [April 7, 2021, 7:59am UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/3 "2021-04-07T07:59:26Z")

</div>

Hello Hans,  
Images says more then words…

 ![SEPA_question](https://www.dolibarr.org/forum/uploads/dolibarrorg/original/2X/a/a164816150b080d8fb0310b0def489dcde59f181.png)

---

<div class="post-metadata">

**Author:** ![Dolisupport.nl](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/dolisupport.nl/32/3564_2.png) [@Dolisupport.nl](https://www.dolibarr.org/forum/u/Dolisupport.nl)\
**Post date:** [April 23, 2021, 12:13am UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/4 "2021-04-23T00:13:46Z")

</div>

Hi Klaas,

Abosolutely true! That makes it clear.  
So both fields are stored in the database, but you need in the xml file the reference of the Thirdparty.  
Well, you need to change the code where the xml is created.  
Here you can read for example the ref from database to change the administration number:  
$thirdparty = new Societe($db);  
$result = $thirdparty-\>fetch($id, $ref, $ref\_ext);  
if ($result \> 0)  
{  
$thirdparty\_result\_fields = array(  
‘id’ =\> $thirdparty-\>id,  
‘ref’ =\> $thirdparty-\>name,  
‘ref\_ext’ =\> $thirdparty-\>ref\_ext);  
}  
But I suppose the field is already loaded, so you have to change it with for example $thirdparty-\>ref\_ext! Find the place were administration number is added and change it with the third party field.

Hope this is helpful to you!

Hans

---

<div class="post-metadata">

**Author:** ![germanacous](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/g/58f4c7/32.png) [@germanacous](https://www.dolibarr.org/forum/u/germanacous)\
**Post date:** [February 14, 2024, 1:25pm UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/5 "2024-02-14T13:25:20Z")

</div>

Hello, were you able to solve this problem?  
I have the same need to have vendoe reference in SEPA XML.

I could not found the where is the code that generates SEPA XML in Dolibarr.

thank you

---

<div class="post-metadata">

**Author:** ![Klaas](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/klaas/32/486_2.png) [@Klaas](https://www.dolibarr.org/forum/u/Klaas)\
**Post date:** [February 14, 2024, 1:47pm UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/6 "2024-02-14T13:47:23Z")

</div>

Hi,  
It was solved in an update, so it works now that de **Ref.Vendor** is sent within the XML file.  
Not the Reference.

Klaas

---

<div class="post-metadata">

**Author:** ![germanacous](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/g/58f4c7/32.png) [@germanacous](https://www.dolibarr.org/forum/u/germanacous)\
**Post date:** [February 15, 2024, 12:47pm UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/7 "2024-02-15T12:47:58Z")

</div>

Hi,

I asked because in XML and also when I import it in Bank application in “Remote information” is:  
“Internal invoice number” - “Ref. vendor”  
example: SI2402-0012 - 5241007522

I need only “Ref. vendor” there.

Therefore I asked, where is the code that generate the XML. I can change it my self.  
I use Dolibarr 19.0.0

thank you

---

<div class="post-metadata">

**Author:** ![moka](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/moka/32/95_2.png) [@moka](https://www.dolibarr.org/forum/u/moka)\
**Post date:** [March 25, 2026, 1:06pm UTC](https://www.dolibarr.org/forum/t/add-vendor-reference-to-sepa-payment-xml/20471/8 "2026-03-25T13:06:03Z")

</div>

Hello every one.  
Had the same problem, made some changes, achieved goal.

**ATTENTION : the following instructions edit the code itself. Make sure you have backups before anything else.**

**INSTRUCTIONS :**

- Edit file : /usr/share/dolibarr/htdocs/compta/prelevement/class/bonprelevement.class
- Go to line #2447
- Change from

```auto
			// A string with some information on payment - 140 max
			$XML_CREDITOR .= ' <Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_ref . ($row_comment ? ' - ' . $row_comment : '')), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max
			

```

- To

```auto
			// A string with some information on payment - 140 max
			$XML_CREDITOR .= ' <Ustrd>' . getDolGlobalString('CREDITTRANSFER_USTRD', dolEscapeXML(dol_trunc(dol_string_nospecial(dol_string_unaccent($row_comment ?: $row_ref), '', '', '', 1), 135, 'right', 'UTF-8', 1))) . '</Ustrd>' . $CrLf; // Free unstructured data - 140 max

```

**Explaining logic :**

- Initial logic : quote $row\_ref (Dolibarr internal reference, SIxxx) and if $row\_comment exists (supplier ref), add it after a dash and two spaces
- Modified logic : quote $row\_comment (suplier ref) and if it does not exist, use $row\_ref (Dolibarr ref) instead.

**Notes :**

- Remember that any Dolibarr update will scratch the modification
- Tested and verified on V 22.0.4

Cheers.
