{"_id":"5c6c2407b8d4b2000e72d9f6","category":{"_id":"5c6c2407b8d4b2000e72d98f","version":"5c6c2407b8d4b2000e72da25","project":"57336fd5a6a9c40e00e13a0b","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-11-03T20:45:01.593Z","from_sync":false,"order":14,"slug":"topics","title":"Guides & Tools"},"project":"57336fd5a6a9c40e00e13a0b","parentDoc":null,"user":"560d5913af97231900938124","version":{"_id":"5c6c2407b8d4b2000e72da25","project":"57336fd5a6a9c40e00e13a0b","__v":0,"forked_from":"5beec5a5f95d82011c6f3714","createdAt":"2018-04-24T15:24:22.608Z","releaseDate":"2018-04-24T15:24:22.608Z","categories":["5c6c2407b8d4b2000e72d981","5c6c2407b8d4b2000e72d982","5c6c2407b8d4b2000e72d983","5c6c2407b8d4b2000e72d984","5c6c2407b8d4b2000e72d985","5c6c2407b8d4b2000e72d986","5c6c2407b8d4b2000e72d987","5c6c2407b8d4b2000e72d988","5c6c2407b8d4b2000e72d989","5c6c2407b8d4b2000e72d98a","5c6c2407b8d4b2000e72d98b","5c6c2407b8d4b2000e72d98c","5c6c2407b8d4b2000e72d98d","5c6c2407b8d4b2000e72d98e","5c6c2407b8d4b2000e72d98f","5c6c2407b8d4b2000e72d990"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":false,"codename":"Main","version_clean":"8976.0.0-XML","version":"8976-XML"},"githubsync":"","__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-10-06T17:27:35.463Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":17,"body":"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. \n\nSee:\n * [How to use metadata](#section-how-to-use-metadata)\n * [Example: Shipping and tax info](#section-example-shipping-and-tax-info)\n * [Example: Product info](#section-example-product-info)\n\n##How to use metadata\nThe 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`.\n\nEach 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](doc:meta-data). \n\nThe 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. \n\n##Example: Shipping and tax info\nUsing 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.\n\nFor example, you might have an order for a total amount of $200 dollars, which includes:\n * $150 for the product that was ordered\n * $20 for state tax\n * $20 for city tax\n * $10 for shipping\n\nYou 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.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n <card-transaction-type>AUTH_ONLY</card-transaction-type>\\n <amount>200.00</amount>\\n <currency>USD</currency>\\n <card-holder-info>\\n <first-name>test first name</first-name>\\n <last-name>test last name</last-name>\\n </card-holder-info>\\n <credit-card>\\n <card-number>4012000033330026</card-number>\\n <security-code>111</security-code>\\n <card-type>VISA</card-type>\\n <expiration-month>07</expiration-month>\\n <expiration-year>2016</expiration-year>\\n </credit-card>\\n <transaction-meta-data>\\n <meta-data>\\n <meta-key>stateTaxAmount</meta-key>\\n <meta-value>20.00</meta-value>\\n <meta-description>State Tax Amount</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>cityTaxAmount</meta-key>\\n <meta-value>20.00</meta-value>\\n <meta-description>City Tax Amount</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>shippingAmount</meta-key>\\n <meta-value>10.00</meta-value>\\n <meta-description>Shipping Amount</meta-description>\\n </meta-data>\\n </transaction-meta-data>\\n</card-transaction>\",\n \"language\": \"xml\",\n \"name\": \"Auth Only request with metadata for tax and shipping\"\n },\n {\n \"code\": \"<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n <card-transaction-type>AUTH_ONLY</card-transaction-type>\\n <transaction-id>38497126</transaction-id>\\n <amount>200.00</amount>\\n <currency>USD</currency>\\n <avs-response-code>G</avs-response-code>\\n <card-holder-info>\\n <first-name>test first name</first-name>\\n <last-name>test last name</last-name>\\n </card-holder-info>\\n <credit-card>\\n <card-last-four-digits>0026</card-last-four-digits>\\n <card-type>VISA</card-type>\\n <card-sub-type>CREDIT</card-sub-type>\\n </credit-card>\\n <transaction-meta-data>\\n <meta-data>\\n <meta-key>stateTaxAmount</meta-key>\\n <meta-value>20.00</meta-value>\\n <meta-description>State Tax Amount</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>cityTaxAmount</meta-key>\\n <meta-value>20.00</meta-value>\\n <meta-description>City Tax Amount</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>shippingAmount</meta-key>\\n <meta-value>10.00</meta-value>\\n <meta-description>Shipping Amount</meta-description>\\n </meta-data>\\n </transaction-meta-data>\\n <processing-info>\\n <processing-status>success</processing-status>\\n <cvv-response-code>MA</cvv-response-code>\\n <avs-response-code-zip>U</avs-response-code-zip>\\n <avs-response-code-address>U</avs-response-code-address>\\n <avs-response-code-name>U</avs-response-code-name>\\n </processing-info>\\n</card-transaction>\",\n \"language\": \"xml\",\n \"name\": \"Auth Only response with transaction ID and metadata for tax and shipping\"\n }\n ],\n \"sidebar\": true\n}\n[/block]\n##Example: Product info\nYou 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. \n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n <card-transaction-type>AUTH_ONLY</card-transaction-type>\\n <amount>20.00</amount>\\n <currency>USD</currency>\\n <card-holder-info>\\n <first-name>test first name</first-name>\\n <last-name>test last name</last-name>\\n </card-holder-info>\\n <credit-card>\\n <card-number>4012000033330026</card-number>\\n <security-code>111</security-code>\\n <card-type>VISA</card-type>\\n <expiration-month>07</expiration-month>\\n <expiration-year>2016</expiration-year>\\n </credit-card>\\n <transaction-meta-data>\\n <meta-data>\\n <meta-key>type</meta-key>\\n <meta-value>tshirt</meta-value>\\n <meta-description>item type</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>size</meta-key>\\n <meta-value>m</meta-value>\\n <meta-description>size info - s/m/l/xl</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>color</meta-key>\\n <meta-value>blue</meta-value>\\n <meta-description>item color</meta-description>\\n </meta-data>\\n </transaction-meta-data>\\n</card-transaction>\",\n \"language\": \"xml\",\n \"name\": \"Auth Only request with metadata for product info\"\n },\n {\n \"code\": \"<card-transaction xmlns=\\\"http://ws.plimus.com\\\">\\n <card-transaction-type>AUTH_ONLY</card-transaction-type>\\n <transaction-id>12345678</transaction-id>\\n <amount>20.00</amount>\\n <currency>USD</currency>\\n <avs-response-code>G</avs-response-code>\\n <card-holder-info>\\n <first-name>test first name</first-name>\\n <last-name>test last name</last-name>\\n </card-holder-info>\\n <credit-card>\\n <card-last-four-digits>0026</card-last-four-digits>\\n <card-type>VISA</card-type>\\n <card-sub-type>CREDIT</card-sub-type>\\n </credit-card>\\n <transaction-meta-data>\\n <meta-data>\\n <meta-key>type</meta-key>\\n <meta-value>tshirt</meta-value>\\n <meta-description>short-sleeve t-shirt</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>size</meta-key>\\n <meta-value>m</meta-value>\\n <meta-description>size info - s/m/l/xl</meta-description>\\n </meta-data>\\n <meta-data>\\n <meta-key>color</meta-key>\\n <meta-value>blue</meta-value>\\n <meta-description>item color</meta-description>\\n </meta-data>\\n </transaction-meta-data>\\n <processing-info>\\n <processing-status>success</processing-status>\\n <cvv-response-code>MA</cvv-response-code>\\n <avs-response-code-zip>U</avs-response-code-zip>\\n <avs-response-code-address>U</avs-response-code-address>\\n <avs-response-code-name>U</avs-response-code-name>\\n </processing-info>\\n</card-transaction>\",\n \"language\": \"xml\",\n \"name\": \"Auth Only response with transaction ID and metadata for product info\"\n }\n ],\n \"sidebar\": true\n}\n[/block]","excerpt":"","slug":"metadata","type":"basic","title":"Metadata Guide"}

Mobile SDK

Metadata Guide

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.

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.

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.