Shipping and Other Charges
You may want to create a method that allows buyers to include shipping or other charges in their transactions.
These charges are maintained for each transaction line.
To include a shipping charge for a transaction line, you add the product_class=S
field and the rest of the details.
If you do use product_class=S
, you must ensure that there is also an equivalent line for physical goods (product_class=P
) that shares at least one of the following. Both lines must be included in the same Transaction object in the same request.
- The same consignment ID is used by both transaction lines. You can use the
consignment_id
field to specify an ID that groups transaction lines that belong to the same consignment together. - The same ship from information is used in each line.
The following example shows you can model a shipping charge by using the same ship_from_address
:
{
"transaction": {
"currency_code": "EUR",
"buyer_name": "Eric Papin",
"ship_to_address": {
"address_detail": "Chateuax 12",
"building_number": "55",
"street_name": "Rue du Saint-Germain",
"city": "Paris",
"postal_code": "75008 ",
"country_code": "FR"
},
"transaction_lines": [
{
"product_class": "S",
"quantity": 1,
"description": "Shipping Charges",
"amount": "5.95",
"custom_id": "test_ID_4",
"import_address": {
"country_code": "FR"
},
"ship_from_address": {
"building_number": "12",
"street_name": "Wessex End Street",
"city": "London",
"postal_code": "SW1A 2AA",
"country_code": "GB"
}
},
{
"product_class": "P",
"quantity": 7,
"description": "UnSmoked herrings",
"amount": "39.95",
"custom_id": "test_ID_4",
"import_address": {
"country_code": "FR"
},
"ship_from_address": {
"building_number": "12",
"street_name": "Wessex End Street",
"city": "London",
"postal_code": "SW1A 2AA",
"country_code": "GB"
}
}
]
}
}
The following example shows you can model a shipping charge by using the same consignment_id
:
{
"transaction": {
"currency_code": "EUR",
"buyer_name": "Eric Papin",
"ship_to_address": {
"address_detail": "Chateuax 12",
"building_number": "55",
"street_name": "Rue du Saint-Germain",
"city": "Paris",
"postal_code": "75008 ",
"country_code": "FR"
},
"transaction_lines": [
{
"product_class": "S",
"quantity": 1,
"description": "Shipping Charges",
"amount": "5.95",
"custom_id": "test_ID_4",
"consignment_id": "001",
"import_address": {
"country_code": "FR"
},
"ship_from_address": {
"building_number": "12",
"street_name": "Wessex End Street",
"city": "London",
"postal_code": "SW1A 2AA",
"country_code": "GB"
}
},
{
"product_class": "P",
"quantity": 7,
"description": "UnSmoked herrings",
"amount": "39.95",
"custom_id": "test_ID_4",
"consignment_id": "001",
"import_address": {
"country_code": "FR"
},
"ship_from_address": {
"building_number": "12",
"street_name": "Wessex End Street",
"city": "London",
"postal_code": "SW1A 2AA",
"country_code": "GB"
}
}
]
}
}
Updated 20 days ago