The Payment API enables you to associate any data you wish to any type of transaction by using the flexible metadata property in your requests. This elegant approach to handling key business data allows you to create fields that append key information to a payment, such as product info, customer info, key dates, shipping and tax, or more. By using metadata, you can store the info that is most useful for your business and build the reporting needed.
See:
How to use metadata
The metadata functionality with our Payment API enables you to directly attach key-value pairs to your transactions, and the details of the metadata will be associated with the transaction-id
. You can then store the metadata fields in your own local database using a reference to the transaction-id
.
Each request can contain up to 20 keys, with key names up to 40 characters long and values up to 500 characters long, providing excellent flexibility to use the metadata fields as you see fit. You can also include a description of up to 40 characters to provide more details about the data. For more information about the meta-data
property, see meta-data.
The metadata specified in the API request is stored at BlueSnap and returned in the API response. However, your metadata is not used by BlueSnap (for example to process transactions), and it will not be displayed to shoppers unless you choose to show it.
Example: Shipping and tax info
Using metadata to handle shipping and tax records is one great use case. As you expand your business and sell in more locations, you are constantly faced with how to handle VAT/Tax and shipping details. The metadata functionality allows you to attach this extra information as part of the transaction.
For example, you might have an order for a total amount of $200 dollars, which includes:
- $150 for the product that was ordered
- $20 for state tax
- $20 for city tax
- $10 for shipping
You would send $200 in the amount
property in the request, and then specify the different tax and shipping amounts in the meta-data
properties. This information will be returned to you along with the transaction ID in the response, so you can easily mark the correct amounts for the product, tax, and shipping in your internal system. This is shown in the sample request and response below.
<card-transaction xmlns="http://ws.plimus.com">
<card-transaction-type>AUTH_ONLY</card-transaction-type>
<amount>200.00</amount>
<currency>USD</currency>
<card-holder-info>
<first-name>test first name</first-name>
<last-name>test last name</last-name>
</card-holder-info>
<credit-card>
<card-number>4012000033330026</card-number>
<security-code>111</security-code>
<card-type>VISA</card-type>
<expiration-month>07</expiration-month>
<expiration-year>2016</expiration-year>
</credit-card>
<transaction-meta-data>
<meta-data>
<meta-key>stateTaxAmount</meta-key>
<meta-value>20.00</meta-value>
<meta-description>State Tax Amount</meta-description>
</meta-data>
<meta-data>
<meta-key>cityTaxAmount</meta-key>
<meta-value>20.00</meta-value>
<meta-description>City Tax Amount</meta-description>
</meta-data>
<meta-data>
<meta-key>shippingAmount</meta-key>
<meta-value>10.00</meta-value>
<meta-description>Shipping Amount</meta-description>
</meta-data>
</transaction-meta-data>
</card-transaction>
<card-transaction xmlns="http://ws.plimus.com">
<card-transaction-type>AUTH_ONLY</card-transaction-type>
<transaction-id>38497126</transaction-id>
<amount>200.00</amount>
<currency>USD</currency>
<avs-response-code>G</avs-response-code>
<card-holder-info>
<first-name>test first name</first-name>
<last-name>test last name</last-name>
</card-holder-info>
<credit-card>
<card-last-four-digits>0026</card-last-four-digits>
<card-type>VISA</card-type>
<card-sub-type>CREDIT</card-sub-type>
</credit-card>
<transaction-meta-data>
<meta-data>
<meta-key>stateTaxAmount</meta-key>
<meta-value>20.00</meta-value>
<meta-description>State Tax Amount</meta-description>
</meta-data>
<meta-data>
<meta-key>cityTaxAmount</meta-key>
<meta-value>20.00</meta-value>
<meta-description>City Tax Amount</meta-description>
</meta-data>
<meta-data>
<meta-key>shippingAmount</meta-key>
<meta-value>10.00</meta-value>
<meta-description>Shipping Amount</meta-description>
</meta-data>
</transaction-meta-data>
<processing-info>
<processing-status>success</processing-status>
<cvv-response-code>MA</cvv-response-code>
<avs-response-code-zip>U</avs-response-code-zip>
<avs-response-code-address>U</avs-response-code-address>
<avs-response-code-name>U</avs-response-code-name>
</processing-info>
</card-transaction>
Example: Product info
You can use metadata to transmit information about the products ordered. For example, if the order is for a medium sized blue t-shirt, you can easily associate this information to the transaction by sending it in the meta-data
properties. See the example request and response below.
<card-transaction xmlns="http://ws.plimus.com">
<card-transaction-type>AUTH_ONLY</card-transaction-type>
<amount>20.00</amount>
<currency>USD</currency>
<card-holder-info>
<first-name>test first name</first-name>
<last-name>test last name</last-name>
</card-holder-info>
<credit-card>
<card-number>4012000033330026</card-number>
<security-code>111</security-code>
<card-type>VISA</card-type>
<expiration-month>07</expiration-month>
<expiration-year>2016</expiration-year>
</credit-card>
<transaction-meta-data>
<meta-data>
<meta-key>type</meta-key>
<meta-value>tshirt</meta-value>
<meta-description>item type</meta-description>
</meta-data>
<meta-data>
<meta-key>size</meta-key>
<meta-value>m</meta-value>
<meta-description>size info - s/m/l/xl</meta-description>
</meta-data>
<meta-data>
<meta-key>color</meta-key>
<meta-value>blue</meta-value>
<meta-description>item color</meta-description>
</meta-data>
</transaction-meta-data>
</card-transaction>
<card-transaction xmlns="http://ws.plimus.com">
<card-transaction-type>AUTH_ONLY</card-transaction-type>
<transaction-id>12345678</transaction-id>
<amount>20.00</amount>
<currency>USD</currency>
<avs-response-code>G</avs-response-code>
<card-holder-info>
<first-name>test first name</first-name>
<last-name>test last name</last-name>
</card-holder-info>
<credit-card>
<card-last-four-digits>0026</card-last-four-digits>
<card-type>VISA</card-type>
<card-sub-type>CREDIT</card-sub-type>
</credit-card>
<transaction-meta-data>
<meta-data>
<meta-key>type</meta-key>
<meta-value>tshirt</meta-value>
<meta-description>short-sleeve t-shirt</meta-description>
</meta-data>
<meta-data>
<meta-key>size</meta-key>
<meta-value>m</meta-value>
<meta-description>size info - s/m/l/xl</meta-description>
</meta-data>
<meta-data>
<meta-key>color</meta-key>
<meta-value>blue</meta-value>
<meta-description>item color</meta-description>
</meta-data>
</transaction-meta-data>
<processing-info>
<processing-status>success</processing-status>
<cvv-response-code>MA</cvv-response-code>
<avs-response-code-zip>U</avs-response-code-zip>
<avs-response-code-address>U</avs-response-code-address>
<avs-response-code-name>U</avs-response-code-name>
</processing-info>
</card-transaction>