-
Notifications
You must be signed in to change notification settings - Fork 68
Option_Create
2Checkout's back office API allows you to retrieve option information. You must specify your API username and password using the the Twocheckout::setCredentials method before calling a method in this class. The Twocheckout_Option class provides methods to create, retrieve, update and delete options and will return a JSON object or array depending on your specification.
##Method
###create
Use to create a option.
####Arguments
-
array Array
-
Array containing create_option parameters in key => value pairs. Parameters -> API Create Option
-
string format
-
Supports 'json' or 'array'. Defines response format. Default: 'json'
####Returns
Returns a JSON object or array depending on your specification.
####Example Usage:
<?php
Twocheckout::setCredentials("APIuser1817037", "APIpass1817037");
$args = array(
'option_name' => 'Example Option',
'option_value_name' => 'Example Option Value Name',
'option_value_surcharge' => 1.00
);
$option = Twocheckout_Option::create($args, 'array');
print_r($option);####Example Response:
Array
(
[option_id] => 4838121600
[response_code] => OK
[response_message] => Option created successfully
)Please feel free to contact 2Checkout directly for assistance with your integration.