Payment
Introduction
The Connector Application for "Electronic Payment" allows external payment gateways to interact with the SOClass-based Customs system to exchange information on electronic invoicing and electronic payments.
In the following, we will refer to the external system that provides features of electronic invoicing and payment as Payment Gateway.
The Connector Payment Module allows the Payment Gateway to receive information on invoices or payment orders from the SOClass based Customs system as well as to send information of payments being processed to the SOClass based Customs system.
Section Sending Invoices Information contains details on the web services that the Payment Gateway should support and that will be consumed by the Connector application to update payment order information.
The next section, Receive Payment Notification, describes the web service published by Connector application that is consumed by the Payment Gateway to send details about an executed payment.
Receive Payment Notification
This endpoint allows the external Payment Gateway to send the information of a payment for a particular invoice.
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://CONNECTOR-URL/api/v1/payment/notification |
| VERB | POST |
| HEADER | Header: Authorization: Bearer <TOKEN> Format: [JSON] |
INPUT Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique identifier of this notification. |
| type | String (255 chars) | Notification type, e.g. invoice.paid, invoice.view, etc. |
| createdAt | String (Datetime ISO 8601 format) | Datetime of creation of this notification. |
| pendingWebhooks | Integer | A number indicating pending webhooks that sill needs to be notified, normally 0. |
| data | Object | JSON Object containing details of the invoice. |
| data.id | String (255 chars) | Unique identifier of the invoice. |
| data.status | String (255 chars) | Invoice status (either PAID, UNPAID, PENDING, VOID). |
| data.totalAmount | Decimal number | Invoice total amount. |
| data.documentNo | String (255 chars) | Unique identifier of the document the invoice refers to. |
| data.paymentNo | String (255 chars) | Payment reference (the unique identifier of this payment). |
| data.paymentDate | String (Datetime ISO 8601 format) | Datetime of the payment execution. |
| data.paymentMode | String (255 chars) | String indicating the mode of payment (either CASH, DIRECT_PAYMENT, etc.) |
| data.collector | String (255 chars) | String indicating the bank or payment operator that executed or collected the payment. |
| data.bankCode | String (255 chars) | String indicating the bank or payment operator that executed or collected the payment. |
| data.additionalFields | Object (array of <code,value> pairs) | An object containing an array of <code,value> pairs that brings additional information of the invoice. These are passed during invoice creation. |
EXAMPLE OF REQUESTS
Request
- JSON
- XML
curl https://CONNECTOR-URL/api/v1/payment/notification \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu' \
-X POST \
-d '{
"id": 4214,
"type": "invoice.paid",
"data": {
"id": "MAN2020-b7598",
"status": "PAID",
"totalAmount": 50000,
"documentNo": "CUO11-574-2020|TEST_PAY|4",
"paymentNo": "gup1dc4",
"paymentDate": "2020-06-05T08:03:05.551832",
"paymentMode": "CARDS",
"collector": "BGUBA1",
"bankCode": "BGUBA1",
"additionalFieldDtos": [
{
"code": "USN",
"value": "USN-2000024"
},
{
"code": "INVOICE_ID",
"value": "4"
},
{
"code": "BOL_REFERENCE",
"value": "TEST_PAY"
},
{
"code": "CUSTOMS_OFFICE",
"value": "CUO11"
}
]
},
"createdAt": "2020-06-05T08:03:35.404869",
"pendingWebhooks": 0
}'
curl https://CONNECTOR-URL/api/v1/payment/notification \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu' \
-X POST \
-d '<?xml version="1.0" encoding="UTF-8" ?>
<payment>
<id>4214</id>
<type>invoice.paid</type>
<data>
<id>MAN2020-b7598</id>
<status>PAID</status>
<totalAmount>50000</totalAmount>
<documentNo>CUO11-574-2020|TEST_PAY|4</documentNo>
<paymentNo>gup1dc4</paymentNo>
<paymentDate>2020-06-05T08:03:05.551832</paymentDate>
<paymentMode>CARDS</paymentMode>
<collector>BGUBA1</collector>
<bankCode>BGUBA1</bankCode>
<additionalFieldDtos>
<code>USN</code>
<value>USN-2000024</value>
</additionalFieldDtos>
<additionalFieldDtos>
<code>INVOICE_ID</code>
<value>4</value>
</additionalFieldDtos>
<additionalFieldDtos>
<code>BOL_REFERENCE</code>
<value>TEST_PAY</value>
</additionalFieldDtos>
<additionalFieldDtos>
<code>CUSTOMS_OFFICE</code>
<value>CUO11</value>
</additionalFieldDtos>
</data>
<createdAt>2020-06-05T08:03:35.404869</createdAt>
<pendingWebhooks>0</pendingWebhooks>
</payment>
'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"id": 4214,
"type": "invoice.paid",
"receivedAt": "2020-06-05T11:03:35.404869",
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<id>4214</id>
<type>invoice.paid</type>
<receivedAt>2020-06-05T11:03:35.404869</receivedAt>
</response>
Sending Invoices Information
The external Payment Gateway receives information about the invoices, or payment requests, that will need to be paid. This information includes the amount to be paid, list of invoice lines as well as other details that can be used by the external Payment Gateway to properly display payment information to the end-user.
Create Invoice
This method is used by the Connector Application for "Electronic Payment" to send information of new invoices to be created to the Payment Gateway.
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://external-system/invoices |
| VERB | POST |
| HEADER | Header: Authorization: Bearer <TOKEN> Accepted Format: [JSON] |
ARGUMENTS
Refer to the Invoice object, which is the input payload used in this web service.
RESPONSE ATTRIBUTES
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| invoiceNumber | String | mandatory | ID of the created invoice |
| status | String | mandatory | Status of the invoice |
| invoiceURL | String | mandatory | URL to the invoice |
EXAMPLE OF REQUESTS
Request
- JSON
- XML
curl https://external-system/invoices \
-X POST \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu' \
-d ' {
"type": "SAD",
"expirationDate": "2019-02-10T12:15:47",
"date": "2005-02-10T12:15:47",
"amount": "45.00",
"currency": "USD",
"discount": "10.00",
"totalAmount": "35.00",
"customerCode": "BTLCI01",
"representativeCode": "8978",
"receiptNumber": "ABCD1234",
"merchantReference": "CAAB1-L-123",
"merchantReferenceURL": "http://issuer-url/declaration/CAAB1-L-123",
"userReference": "BOLLORE01235",
"items": [
{
"name": "DD",
"amount": "20.00",
"beneficiaryCode": "21"
},
{
"name": "RST",
"amount": "25.00",
"beneficiaryCode": "22"
}
],
"invoiceBeneficiaries": [
{
"beneficiaryCode": "21",
"amount": "20.00"
},
{
"beneficiaryCode": "22",
"amount": "25.00"
}
],
"additionalFields": [
{
"code": "customsDeclarationType",
"value": "IM"
},
{
"code": "customsOffice",
"value": "CAAB1"
},
{
"code": "customsRegime",
"value": "42"
},
{
"code": "customsRegistrationNum",
"value": "12746"
},
{
"code": "customsRegistrationDate",
"value": "2018-01-01Z"
},
{
"code": "customsAssessmentNum",
"value": "123"
},
{
"code": "customsAssessmentSerial",
"value": "L"
},
{
"code": "customsAssessmentDate",
"value": "2018-01-01"
},
{
"code": "customsDeclarantCode",
"value": "8978"
},
{
"code": "customsDeclarantName",
"value": "Declarant XYZ"
},
{
"code": "customsDeclarantAddress",
"value": "3, Park Lane, City, State"
}, {
"code": "documentNo",
"value": "TST1201901260"
},
{
"code": "documentDate",
"value": "2018-01-01Z"
}, {
"code": "documentReference",
"value": "LIC201900001430"
}
]
}
'
curl https://external-system/invoices \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \
-X POST \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu' \
-d '<?xml version="1.0" encoding="UTF-8" ?>
<invoice>
<type>SAD</type>
<expirationDate>2019-02-10T12:15:47</expirationDate>
<date>2005-02-10T12:15:47</date>
<amount>45.00</amount>
<currency>USD</currency>
<discount>10.00</discount>
<totalAmount>35.00</totalAmount>
<customerCode>BTLCI01</customerCode>
<representativeCode>8978</representativeCode>
<receiptNumber>ABCD1234</receiptNumber>
<merchantReference>CAAB1-L-123</merchantReference>
<merchantReferenceURL>http://issuer-url/declaration/CAAB1-L-123</merchantReferenceURL>
<userReference>BOLLORE01235</userReference>
<items>
<name>DD</name>
<amount>20.00</amount>
<beneficiaryCode>21</beneficiaryCode>
</items>
<items>
<name>RST</name>
<amount>25.00</amount>
<beneficiaryCode>22</beneficiaryCode>
</items>
<invoiceBeneficiaries>
<beneficiaryCode>21</beneficiaryCode>
<amount>20.00</amount>
</invoiceBeneficiaries>
<invoiceBeneficiaries>
<beneficiaryCode>22</beneficiaryCode>
<amount>25.00</amount>
</invoiceBeneficiaries>
<additionalFields>
<code>customsDeclarationType</code>
<value>IM</value>
</additionalFields>
<additionalFields>
<code>customsOffice</code>
<value>CAAB1</value>
</additionalFields>
<additionalFields>
<code>customsRegime</code>
<value>42</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationNum</code>
<value>12746</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentNum</code>
<value>123</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentSerial</code>
<value>L</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentDate</code>
<value>2018-01-01</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantCode</code>
<value>8978</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantName</code>
<value>Declarant XYZ</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantAddress</code>
<value>3, Park Lane, City, State</value>
</additionalFields>
<additionalFields>
<code>documentNo</code>
<value>TST1201901260</value>
</additionalFields>
<additionalFields>
<code>documentDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>documentReference</code>
<value>LIC201900001430</value>
</additionalFields>
</invoice>
'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"invoiceNumber": "SAD2019-186a0",
"status": "UNPAID",
"invoiceUrl": ""
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<invoiceNumber>SAD2019-186a0</invoiceNumber>
<status>UNPAID</status>
<invoiceUrl></invoiceUrl>
</response>
Void Invoice
This endpoint allows the Connector Application for "Electronic Payment" to send the external Payment Gateway a request to void (or cancel) an existing invoice.
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://external-system/invoices/:invoiceNumber/void |
| VERB | PATCH |
| HEADER | Header: Authorization: Bearer <TOKEN> Format: [JSON] |
EXAMPLE OF REQUESTS
Request
curl https://external-system/invoices/SAD2019-186a0/void \
-X PATCH \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"type": "SAD",
"expirationDate": "2019-02-10T12:15:47",
"date": "2019-02-10T12:15:47",
"amount": 45,
"invoiceNumber": "SAD2019-0",
"status": "VOID",
"tax": 0,
"fee": 0,
"currency": "USD",
"discount": 10,
"totalAmount": 35,
"customerCode": "BTLCI01",
"representativeCode": "8978",
"merchantReference": "CAAB1-L-123",
"merchantReferenceURL": "http://issuer-url/declaration/CAAB1-L-123",
"userReference": "BOLLORE01235",
"merchant": {
"code": "01",
"name": "Merchant Name",
"address": "12, Sunrise Ave."
},
"items": [
{
"name": "DD",
"amount": 20,
"beneficiaryCode": "21"
},
{
"name": "RST",
"amount": 25,
"beneficiaryCode": "22"
}
],
"additionalFields": [
{
"code": "customsDeclarationType",
"value": "IM"
},
{
"code": "customsOffice",
"value": "CAAB1"
},
{
"code": "customsRegime",
"value": "42"
},
{
"code": "customsRegistrationNum",
"value": "12746"
},
{
"code": "customsRegistrationDate",
"value": "2018-01-01Z"
},
{
"code": "customsAssessmentNum",
"value": "123"
},
{
"code": "customsAssessmentSerial",
"value": "L"
},
{
"code": "customsAssessmentDate",
"value": "2018-01-01"
},
{
"code": "customsDeclarantCode",
"value": "8978"
},
{
"code": "customsDeclarantName",
"value": "Declarant XYZ"
},
{
"code": "customsDeclarantAddress",
"value": "3, Park Lane, City, State"
},
{
"code": "documentNo",
"value": "TST1201901260"
},
{
"code": "documentDate",
"value": "2018-01-01Z"
},
{
"code": "documentReference",
"value": "LIC201900001430"
}
],
"invoiceBeneficiaries": [
{
"amount": 20,
"beneficiaryCode": "21",
"beneficiaryName": "ORGANISATION A"
},
{
"amount": 25,
"beneficiaryCode": "22",
"beneficiaryName": "ORGANISATION B"
}
]
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<type>SAD</type>
<expirationDate>2019-02-10T12:15:47</expirationDate>
<date>2019-02-10T12:15:47</date>
<amount>45</amount>
<invoiceNumber>SAD2019-0</invoiceNumber>
<status>VOID</status>
<tax>0</tax>
<fee>0</fee>
<currency>USD</currency>
<discount>10</discount>
<totalAmount>35</totalAmount>
<customerCode>BTLCI01</customerCode>
<representativeCode>8978</representativeCode>
<merchantReference>CAAB1-L-123</merchantReference>
<merchantReferenceURL>http://issuer-url/declaration/CAAB1-L-123</merchantReferenceURL>
<userReference>BOLLORE01235</userReference>
<merchant>
<code>01</code>
<name>Merchant Name</name>
<address>12, Sunrise Ave.</address>
</merchant>
<items>
<name>DD</name>
<amount>20</amount>
<beneficiaryCode>21</beneficiaryCode>
</items>
<items>
<name>RST</name>
<amount>25</amount>
<beneficiaryCode>22</beneficiaryCode>
</items>
<additionalFields>
<code>customsDeclarationType</code>
<value>IM</value>
</additionalFields>
<additionalFields>
<code>customsOffice</code>
<value>CAAB1</value>
</additionalFields>
<additionalFields>
<code>customsRegime</code>
<value>42</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationNum</code>
<value>12746</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentNum</code>
<value>123</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentSerial</code>
<value>L</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentDate</code>
<value>2018-01-01</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantCode</code>
<value>8978</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantName</code>
<value>Declarant XYZ</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantAddress</code>
<value>3, Park Lane, City, State</value>
</additionalFields>
<additionalFields>
<code>documentNo</code>
<value>TST1201901260</value>
</additionalFields>
<additionalFields>
<code>documentDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>documentReference</code>
<value>LIC201900001430</value>
</additionalFields>
<invoiceBeneficiaries>
<amount>20</amount>
<beneficiaryCode>21</beneficiaryCode>
<beneficiaryName>ORGANISATION A</beneficiaryName>
</invoiceBeneficiaries>
<invoiceBeneficiaries>
<amount>25</amount>
<beneficiaryCode>22</beneficiaryCode>
<beneficiaryName>ORGANISATION B</beneficiaryName>
</invoiceBeneficiaries>
</response>
Pay Invoice
This endpoint allows the Connector Application for "Electronic Payment" to send the external Payment Gateway a request to mark an existing invoice as paid within the Customs system.
| Parameter | Description |
|---|---|
| HTTP REQUEST | https://external-system/invoices/:invoiceNumber/pay |
| VERB | PATCH |
| HEADER | Header: Authorization: Bearer <TOKEN> Format: [JSON] |
EXAMPLE OF REQUESTS
Request
curl https://external-system/invoices/SAD2019-186a0/pay \
-X PATCH \
-H 'Authorization: Bearer bsdcojzT-9i4q-TaNE-0T8u-gEBcXE2U8jtu'
Response HTTP/1.1 200 OK
- JSON
- XML
{
"type": "SAD",
"expirationDate": "2019-02-10T12:15:47",
"date": "2019-02-10T12:15:47",
"amount": 45,
"invoiceNumber": "SAD2019-0",
"status": "PAID",
"tax": 0,
"fee": 0,
"currency": "USD",
"discount": 10,
"totalAmount": 35,
"customerCode": "BTLCI01",
"representativeCode": "8978",
"merchantReference": "CAAB1-L-123",
"merchantReferenceURL": "http://issuer-url/declaration/CAAB1-L-123",
"userReference": "BOLLORE01235",
"merchant": {
"code": "01",
"name": "Merchant Name",
"address": "12, Sunrise Ave."
},
"items": [
{
"name": "DD",
"amount": 20,
"beneficiaryCode": "21"
},
{
"name": "RST",
"amount": 25,
"beneficiaryCode": "22"
}
],
"additionalFields": [
{
"code": "customsDeclarationType",
"value": "IM"
},
{
"code": "customsOffice",
"value": "CAAB1"
},
{
"code": "customsRegime",
"value": "42"
},
{
"code": "customsRegistrationNum",
"value": "12746"
},
{
"code": "customsRegistrationDate",
"value": "2018-01-01Z"
},
{
"code": "customsAssessmentNum",
"value": "123"
},
{
"code": "customsAssessmentSerial",
"value": "L"
},
{
"code": "customsAssessmentDate",
"value": "2018-01-01"
},
{
"code": "customsDeclarantCode",
"value": "8978"
},
{
"code": "customsDeclarantName",
"value": "Declarant XYZ"
},
{
"code": "customsDeclarantAddress",
"value": "3, Park Lane, City, State"
},
{
"code": "documentNo",
"value": "TST1201901260"
},
{
"code": "documentDate",
"value": "2018-01-01Z"
},
{
"code": "documentReference",
"value": "LIC201900001430"
}
],
"invoiceBeneficiaries": [
{
"amount": 20,
"beneficiaryCode": "21",
"beneficiaryName": "ORGANISATION A"
},
{
"amount": 25,
"beneficiaryCode": "22",
"beneficiaryName": "ORGANISATION B"
}
]
}
<?xml version="1.0" encoding="UTF-8" ?>
<response>
<type>SAD</type>
<expirationDate>2019-02-10T12:15:47</expirationDate>
<date>2019-02-10T12:15:47</date>
<amount>45</amount>
<invoiceNumber>SAD2019-0</invoiceNumber>
<status>PAID</status>
<tax>0</tax>
<fee>0</fee>
<currency>USD</currency>
<discount>10</discount>
<totalAmount>35</totalAmount>
<customerCode>BTLCI01</customerCode>
<representativeCode>8978</representativeCode>
<merchantReference>CAAB1-L-123</merchantReference>
<merchantReferenceURL>http://issuer-url/declaration/CAAB1-L-123</merchantReferenceURL>
<userReference>BOLLORE01235</userReference>
<merchant>
<code>01</code>
<name>Merchant Name</name>
<address>12, Sunrise Ave.</address>
</merchant>
<items>
<name>DD</name>
<amount>20</amount>
<beneficiaryCode>21</beneficiaryCode>
</items>
<items>
<name>RST</name>
<amount>25</amount>
<beneficiaryCode>22</beneficiaryCode>
</items>
<additionalFields>
<code>customsDeclarationType</code>
<value>IM</value>
</additionalFields>
<additionalFields>
<code>customsOffice</code>
<value>CAAB1</value>
</additionalFields>
<additionalFields>
<code>customsRegime</code>
<value>42</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationNum</code>
<value>12746</value>
</additionalFields>
<additionalFields>
<code>customsRegistrationDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentNum</code>
<value>123</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentSerial</code>
<value>L</value>
</additionalFields>
<additionalFields>
<code>customsAssessmentDate</code>
<value>2018-01-01</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantCode</code>
<value>8978</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantName</code>
<value>Declarant XYZ</value>
</additionalFields>
<additionalFields>
<code>customsDeclarantAddress</code>
<value>3, Park Lane, City, State</value>
</additionalFields>
<additionalFields>
<code>documentNo</code>
<value>TST1201901260</value>
</additionalFields>
<additionalFields>
<code>documentDate</code>
<value>2018-01-01Z</value>
</additionalFields>
<additionalFields>
<code>documentReference</code>
<value>LIC201900001430</value>
</additionalFields>
<invoiceBeneficiaries>
<amount>20</amount>
<beneficiaryCode>21</beneficiaryCode>
<beneficiaryName>ORGANISATION A</beneficiaryName>
</invoiceBeneficiaries>
<invoiceBeneficiaries>
<amount>25</amount>
<beneficiaryCode>22</beneficiaryCode>
<beneficiaryName>ORGANISATION B</beneficiaryName>
</invoiceBeneficiaries>
</response>