payment-methods

payment-methods.compute-costs

Calculates payment costs, taxes included, for one or more amounts to pay.

JS
CR.api('commerce.payment-methods.compute-costs', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.compute-costs

request

{
  "amounts" : [ 34.602, 86.058, … ], // amounts that have to be paied (required) - decimal[10,3](0…)
  "taxArea" : 5 // tax area (id) with which calculate taxes (required) - int(1…)
  "conditions" : { // return only costs for payment methods ...
    "ids" : [ 3, 7, … ], // ... with these identifiers - int(1…)
    "isActive" : true, // ... that are active - bool
    "isDefault" : false // ... that are the default - bool
  }
}

response

{
  "status" : "ok",
  "costs" : [ { // payment methods (id) and relative costs, taxes included - int(1…) -> decimal[10,3](0…)
      "3" : 2.061,
      "7" : 1.890,
      …
    }, … ]
  }
}

Errors

Field Type Description
taxArea NotFound Tax area <taxArea> does not exist

payment-methods.find

Returns the payment methods that meet the given conditions.

JS
CR.api('commerce.payment-methods.find', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.find

request

{
  "conditions" : { // returns the payment methods …
    "ids" : [ 3, 7, … ], // … with these identifiers - int(1…)
    "isActive" : true, // … that are visible or not visible on the shop - bool
    "isDefault" : false // … that are the default payment method or not - bool
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "name", … ], // fields to return - string
  "order" : [ "name" ], // sort order of returned payment methods, can contain "id", "-id", "name", "-name", "isOnDelivery",
                        // "-isOnDelivery", "isActive", "-isActive", "provider" and "-provider" - string
  "limit" : 10, // maximum number of methods to return - int(1…100)
  "first" : 0 // index of the first method to return - int(0…)
}

response

{
  "status" : "ok",
  "paymentMethods" : [ {
    "id" : 3, // identifier - int(1…)
    "name" : { // name - string(2) -> string(0…80)
      "en" : "Credit card",
      "it" : "Carta di credito"
    },
    "description" : { // description - string(2) -> string(0…255)
      "en" : "Visa and Mastercard",
      "it" : "Visa e Mastercard"
    },
    "instructions" : { // instructions for payment - string(2) -> string(0…255)
      "en" : "Click Pay",
      "it" : "Fai clic su Paga"
    },
    "isOnDelivery" : false, // indicates if the payment is on delivery - bool
    "isActive" : true, // indicates if it is visible on shop - bool
    "isDefault" : false, // indicates if it is the default payment method - bool
    "maxAmountPayable" : 3000.000, // maximum amount that can be paied - decimal[10,3](0…)
    "percentFee" : 2.500, // percent payment fee - decimal[5,3](0…)
    "fixedFee" : 0.200, // fixed payment fee - decimal[8,3](0…)
    "minimumFee" : 0.000, // minimum fee for a payment - decimal[8,3](0…)
    "taxClass" : 7, // tax class (id) with which calculate taxes (can be null) - int(1…)
    "provider" : "PayPal", // payment provider (can be null) - string(1…15)
    "providerSettings" : { // payment provider settings (can be null) - string(1…100) -> string(0…1000)
      "business" : "orders@mydomain.com",
      "sandbox"  : "0"
    }
  }, … ]
}

payment-methods.get

Returns a payment method given its identifier.

JS
CR.api('commerce.payment-methods.get', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.get

request

{
  "id" : 3, // identifier (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "name", … ] // fields to return - string
}

response

{
  "status" : "ok",
  "paymentMethod" : { // (can be null)
    "id" : 3, // identifier - int(1…)
    "name" : { // name - string(2) -> string(0…80)
      "en" : "Credit card",
      "it" : "Carta di credito"
    },
    "description" : { // description - string(2) -> string(0…255)
      "en" : "Visa and Mastercard",
      "it" : "Visa e Mastercard"
    },
    "instructions" : { // instructions for payment - string(2) -> string(0…255)
      "en" : "Click Pay",
      "it" : "Fai clic su Paga"
    },
    "isOnDelivery" : false, // indicates if the payment is on delivery - bool
    "isActive" : true, // indicates if it is visible on shop - bool
    "isDefault" : false, // indicates if it is the default payment method - bool
    "maxAmountPayable" : 3000.000, // maximum amount that can be paied - decimal[10,3](0…)
    "percentFee" : 2.500, // percent payment fee - decimal[5,3](0…)
    "fixedFee" : 0.200, // fixed payment fee - decimal[8,3](0…)
    "minimumFee" : 0.000, // minimum fee for a payment - decimal[8,3](0…)
    "taxClass" : 7, // tax class (id) with which calculate taxes (can be null) - int(1…)
    "provider" : "PayPal", // payment provider (can be null) - string(1…15)
    "providerSettings" : { // payment provider settings (can be null) - string(1…100) -> string(0…1000)
      "business" : "orders@mydomain.com",
      "sandbox"  : "0"
    }
  }
}

payment-methods.count

Number of payment methods that meet the given conditions.

JS
CR.api('commerce.payment-methods.count', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.count

request

{
  "conditions" : { // counts the payment methods …
    "ids" : [ 3, 7, … ], // … with these identifiers - int(1…)
    "isActive" : true, // … that are visible or not visible on the shop - bool
    "isDefault" : false // … that are the default payment method or not - bool
  }
}

response

{
  "status" : "ok",
  "count" : 4 // number of payment methods - int(0…)
}

payment-methods.create

Creates a new payment method.

JS
CR.api('commerce.payment-methods.create', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.create

request

{
  "paymentMethod" : { // payment method to create (required)
    "name" : { // name - string(2) -> string(0…80)
      "en" : "Credit card",
      "it" : "Carta di credito"
    },
    "description" : { // description - string(2) -> string(0…255)
      "en" : "Visa and Mastercard",
      "it" : "Visa e Mastercard"
    },
    "instructions" : { // instructions for payment - string(2) -> string(0…255)
      "en" : "Click Pay",
      "it" : "Fai clic su Paga"
    },
    "isOnDelivery" : false, // indicates if the payment is on delivery - bool
    "isActive" : true, // indicates if it is visible on shop - boo    
    "isDefault" : false // indicates if it is the default payment method - bool
    "maxAmountPayable" : 3000.00, // maximum amount that can be paied - decimal[10,3](0…)
    "percentFee" : 2.500, // percent payment fee - decimal[5,3](0…)
    "fixedFee" : 0.200, // fixed payment fee - decimal[8,3](0…)
    "minimumFee" : 0.000, // minimum fee for a payment - decimal[8,3](0…)
    "taxClass" : 7, // tax class (id) with which calculate taxes (can be null) - int(1…)
    "provider" : "PayPal", // payment provider - string(1…18)
    "providerSettings" : { // payment provider settings - string(1…100) -> string(0…1000)
      "business" : "orders@mydomain.com",
      "sandbox"  : "0"
    }
}

response

{
  "status" : "ok",
  "id" : 3 // identifier of the new payment method - int(1…)
}

Errors

Field Type Description
provider NotFound Payment provider '<provider>' does not exist
providerSettings InvalidCombination 'providerSettings' is required if 'provider' is provided
providerSettings InvalidCombination 'providerSettings' is not allowed without 'provider'
providerSettings InvalidValue Provider settings are not valid: <provider errors>

payment-methods.update

Updates a payment method. Any fields left out of the request will remain unchanged.

JS
CR.api('commerce.payment-methods.update', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.update

request

{
  "id" : 3, // identifier of the payment method to update (required) - int(1…)
  "paymentMethod" : { // payment method's fields to update (required)
    "name" : { // name - string(2) -> string(0…80)
      "en" : "Credit card",
      "it" : "Carta di credito"
    },
    "description" : { // description - string(2) -> string(0…255)
      "en" : "Visa and Mastercard",
      "it" : "Visa e Mastercard"
    },
    "instructions" : { // instructions for payment - string(2) -> string(0…255)
      "en" : "Click Pay",
      "it" : "Fai clic su Paga"
    },
    "isOnDelivery" : false, // indicates if the payment is on delivery - bool
    "isActive" : true, // indicates if it is visible on shop - boo    
    "isDefault" : false // indicates if it is the default payment method - bool
    "maxAmountPayable" : 3000.00, // maximum amount that can be paied - decimal[10,3](0…)
    "percentFee" : 2.500, // percent payment fee - decimal[5,3](0…)
    "fixedFee" : 0.200, // fixed payment fee - decimal[8,3](0…)
    "minimumFee" : 0.000, // minimum fee for a payment - decimal[8,3](0…)
    "taxClass" : 7, // tax class (id) with which calculate taxes (can be null) - int(1…)
    "provider" : "PayPal", // payment provider - string(1…18)
    "providerSettings" : { // payment provider settings - string(1…100) -> string(0…1000)
      "business" : "orders@mydomain.com",
      "sandbox"  : "0"
    }
  }
}

response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Payment method <id> does not exist
provider InvalidValue 'provider' can not be changed because payment method does not have a provider
providerSettings InvalidValue Provider settings are not valid: <provider errors>

payment-methods.delete

Deletes one o more payment methods.

JS
CR.api('commerce.payment-methods.delete', request, function(response) { … });
HTTP
POST /open2b/api/v3/commerce.payment-methods.delete

request

{
  "ids" : [ 3, 7, … ] // identifiers of the payment methods to delete (required) - int(1…)
}

response

{
  "status" : "ok"
}