Skip to main content

Create Option

Last updated: 05-Jan-2022
Rate this article:

Overview

The create_option call is used to create a new product option.

URL: https://www.2checkout.com/api/products/create_option

HTTP Method: POST


Input Parameters

Parameter Description
option_name Name of new product option. Required.
option_value_name Name of option value. Multiples allowed but must equal number of option_value_surcharges supplied (&option_value_name=xxxxxxxx&option_value_name=yyyyyyyyy). Required.
option_value_surcharge Amount of option value. Multiples allowed but must equal number of option_value_names supplied (&option_value_surcharge=xxxxxxxx&option_value_surcharge=yyyyyyyyy). Required.

Data Returned

Parameter Description
response_code Tells the user whether or not the operation was successful.
response_message Tells the user why the operation was or was not successful.
option_id ID assigned to the option by 2Checkout.

Example API Call

curl -X POST https://www.2checkout.com/api/products/create_option \
    -H 'Accept: application/json' -u 'username:password' \
    -d 'option_name=test' -d 'option_value_name=red' -d 'option_value_surcharge=1.00' \
    -d 'option_value_name=blue' -d 'option_value_surcharge=1.00'

Example Successful Response

    {
       "option_id" : "1234567890",
       "response_code" : "OK",
       "response_message" : "Option created successfully"
    }

Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter:
Rate this article:

Need help?

Do you have a question? If you didn’t find the answer you are looking for in our documentation, you can contact our Support teams for more information. If you have a technical issue or question, please contact us. We are happy to help.

Not yet a Verifone customer?

We’ll help you choose the right payment solution for your business, wherever you want to sell, in-person or online. Our team of experts will happily discuss your needs.

Verifone logo