Example: create payment surcharge with flat amount pricing per transaction
POST /commerce/surcharges
{
"description": "a surcharge",
"category": "payment_surcharge",
"name": "surcharge-1",
"reversible": true,
"attributes": [
{
"name": "CardType",
"type": "String"
// type can be specified or user can specify object mapping
// for payment surcharge object mapping will be enforced
// either mapping or type can be specified, not both
"mapping":{
"object":"PaymentMethod",
"field":"CardType"
}
},
{
"name": "Provider",
"type": "String"
}
],
"data": [
{
"attributes": [
{
"name": "CardType",
"operator": "==",
"value": {
"string_value": "Credit"
}
},
{
"name": "Provider",
"operator": "==",
"value": {
"string_value": "Visa"
}
}
],
"pricing": {
"amount": 3
}
},
{
"attributes": [
{
"name": "CardType",
"value": {
"string_value": "Credit"
}
},
{
"name": "Provider",
"value": {
"string_value": "Master"
}
}
],
"pricing": {
"amount": 2.5
}
},
{
"attributes": [
{
"name": "CardType",
"value": {
"string_value": "Credit"
}
},
{
"name": "Provider",
"value": {
"string_value": "Amex"
}
}
],
"pricing": {
"amount": 2.3
}
}
]
}
|