At VTEX, payment providers have the option of using Payment Provider Protocol (PPP) endpoints to record additional information that they consider essential for processing a transaction. This can include data related to orders or other platform modules, payment identifiers created by the provider, and internal operations logs.
To use this functionality, it is necessary to create metadata information fields on the PPP endpoints.
Adding metadata information to your payment transactions
To use metadata in the provider's payment transactions, follow the steps below:
- Update the provider manifest to include the
metadataFields
array and forward it to VTEX. This array must contain a maximum of 3 strings, each with a maximum length of 20 characters, which will represent the names of the metadata fields to be sent by the provider. See an example below:
_10..._10"metadataFields": [_10 "MetadataName1",_10 "MetadataName2"_10 ]_10...
-
Add the
connectorMetadata
array to the request body of the following endpoints (Create Payment, Cancel Payment, Settle Payment, Refund Payment and Inbound Request (BETA)). The array must contain the following information:name
: string that identifies the name of the metadata field inserted in the provider manifest (maximum limit of 20 characters).value
: string containing the metadata (maximum limit of 200 characters).
See an example below:
_12..._12"connectorMetadata": [_12 {_12 "name": "MetadataName1",_12 "value": "MetadataValue1"_12 },_12 {_12 "name": "MetadataName2",_12 "value": "MetadataValue2"_12 },_12]_12...
- After sending one of the endpoint requests from the previous step, the response body will return the payment and metadata information, indicating that they were stored in the VTEX gateway. See an example of the response body from the Refund Payment endpoint.
_18{_18 "paymentId": "F5C2A4E21D3B4E09B7E871F5B6BC9F91",_18 "refundId": "2EA324981E7E4BCC9F9D7B46874C2594",_18 "value": 57,_18 "code": null,_18 "message": "Successfully refunded",_18 "requestId": "LB4E40D3B4G07B7B871F5B4BC3F31",_18 "connectorMetadata": [_18 {_18 "name": "MetadataName1",_18 "value": "MetadataValue1"_18 },_18 {_18 "name": "MetadataName2",_18 "value": "MetadataValue2"_18 }_18 ]_18}