Skip to main content
knowledgecenter.2checkout.com

Use Konbini

Overview

Place an order with catalog products defined in your Control Panel and collect the payment using Konbini.

Requirements

Shoppers in Japan can purchase using Konbini. The billing country and the order country code has to be JP.

Supported currencies

  • JPY

Workflow

  1. If the shopper is located in Japan and is paying in Japanese Yens, then in the shopping cart they can choose Konbini as a payment method.
  2. In the checkout form, it is mandatory to fill in the phone number in the billing details.
  3. After the order is generated by calling the placeOrder method, in the order's details the shopper will find a URL where they need to be redirected in order to finalize the payment.
  4. The URL can be found in the PaymentDetails/PaymentMethod response object. Also, a PaymentReference number is returned on the same level; this will contain the reference number of the payment in the Konbini system.
  5. Once the shopper finishes the payment process on the Konbini side, the order will be updated in the 2Checkout system as well.

Parameters

Parameters Type/Description

sessionID

Required (string)

 

Session identifier, the output of the Login method. Include sessionID into all your requests. 2Checkout throws an exception if the values are incorrect.  The sessionID expires in 10 minutes.

Order

Required (Object)

 

Object designed to collect all data necessary for an order, including billing, product/subscription plan and payment details.

See code sample for more details. 

 

Request Example

<?php

echo '<pre>';

function callRPC($Request, $host, $Debug = true) {
    $curl = curl_init($host);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curl, CURLOPT_VERBOSE, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($curl, CURLOPT_SSLVERSION, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Accept: application/json', 'Cookie: XDEBUG_SESSION=PHPSTORM'));
    $RequestString = json_encode($Request);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $RequestString);

    $ResponseString = curl_exec($curl);

    if (!empty($ResponseString)) {
        var_dump($ResponseString);
        $Response = json_decode($ResponseString);
        if (isset($Response->result)) {
            return $Response->result;
        }
        if (!is_null($Response->error)) {
            var_dump($Request->method, $Response->error);
        }
    } else {
        return null;
    }
}

$host = 'http://api.sandbox110.avangate.local/rpc/6.0/';

$merchantCode = "120000552495"; 
$key = "i|=Z8(A4k8(g39]M2*e4";
// $productCode = "089F06CC45"; 
$string = strlen($merchantCode) . $merchantCode . strlen(gmdate('Y-m-d H:i:s')) . gmdate('Y-m-d H:i:s');
$hash = hash_hmac('md5', $string, $key);

$i = 1;

$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'login';
$jsonRpcRequest->params = array($merchantCode, gmdate('Y-m-d H:i:s'), $hash);
$jsonRpcRequest->id = $i++;

$sessionID = callRPC($jsonRpcRequest, $host);

echo $sessionID;;

// H@NDLINGGR0SS
// H@NDLINGN3T
$productCode = "151D8D2C20";
 // $productQuantity = 27;
 $defaultCurr = "JPY";
 $defaultCountry = "JP";



/**/ // end building $CartObj

$CartObj = new stdClass();
$CartObj->Currency = $defaultCurr;
$CartObj->Language = "EN";
$CartObj->Country =  $defaultCountry;
$CartObj->CountryCode = "JP";
$CartObj->CustomerIP = '91.220.121.21';//"10.10.13.37";
$CartObj->Source = "sourceAPI.net";

//$CartObj->ExternalReference = "API2.5_PLACE_ORDER_EXT_" . date("Y-m-d h:m:i");
//$CartObj->AffiliateId = 10244;
$CartObj->LocalTime = date('Y-m-d H:i:s');
$CartObj->CustomerReference = '421820' . strval(rand (100, 999));
$CartObj->Items = array();

$CartObj->Items[0] = new stdClass();
$CartObj->Items[0]->Code = $productCode;//"3333399999_COPY1";//"155887799"; - vld_licence_1month //"12345"; -vld_regular
$CartObj->Items[0]->Quantity = 1;
//$CartObj->Items[0]->Price = 3;

$CartObj->Items[0]->PriceOptions = [];

$priceOption = new stdClass();
$priceOption->Name = 'Users';
$priceOption->Code = 'USERS_1';
$priceOption->Options = [];

$priceOptionOption = new stdClass();
$priceOptionOption->Name = '10 users';
$priceOptionOption->Value = '10_users';
$priceOptionOption->Surcharge = 0;

$priceOption->Options[] = $priceOptionOption;
$CartObj->Items[0]->PriceOptions[] = $priceOption;

$priceOption2 = new stdClass();
$priceOption2->Name = 'Maintenance period';
$priceOption2->Code = 'MAINTE_PERIOD';
$priceOption2->Options = [];

$priceOptionOption2 = new stdClass();
$priceOptionOption2->Name = '12 months';
$priceOptionOption2->Value = 'jira_maintenance_12_mths';
$priceOptionOption2->Surcharge = 0;

$priceOption2->Options[] = $priceOptionOption2;
$CartObj->Items[0]->PriceOptions[] = $priceOption2;

/**/
$additionalField1 = new stdClass();
$additionalField1->Code = "additional_field_order_1";
$additionalField1->Text = "REST";
$additionalField1->Value = "1";

$additionalField2 = new stdClass();
$additionalField2->Code = "additional_field_order_2";
$additionalField2->Text = "REST";
$additionalField2->Value = "a";

$additionalField3 = new stdClass();
$additionalField3->Code = "additional_field_order_3";
$additionalField3->Text = "REST";
$additionalField3->Value = "a";

$CartObj->AdditionalFields = array();
$CartObj->AdditionalFields[0] = $additionalField1;
$CartObj->AdditionalFields[1] = $additionalField2;
$CartObj->AdditionalFields[2] = $additionalField3;


$additionalField1 = new stdClass();
$additionalField1->Code = "additional_field_product_1";
$additionalField1->Text = "PRODUCT1 TEXT";
$additionalField1->Value = true;

$CartObj->Items[0]->AdditionalFields = array();
$CartObj->Items[0]->AdditionalFields[0] = $additionalField1;

//$CartObj->Promotions = ["48606DBB"];

$CartObj->MachineId = 'machineIdTestDan';
$CartObj->Discount = null;
$CartObj->ExternalReference = null;

$phone = '80-1234-5678'; // mandatory for Konbini pay method (this is the recommended phone # for dev env)
//$phone = '8-495-213-34-85'; // valid phone number (10-11 digits after stripping off spaces, dashes, slashes etc).
//$phone = ' '; // empty
//$phone = '80-1234-8765'; // other value than the recommended one
//$phone = '0040-21-335.54.78'; // other prefix than 80, invalid number of digits

$country = 'JP'; $state = ''; $city = 'Osaka';
//$country = 'US'; $state = 'GA'; $city = 'Atlanta';

$currency = 'JPY';
//$currency = 'USD';

$CartObj->BillingDetails = new stdClass();
$CartObj->BillingDetails->IsCompany = false;
//$CartObj->BillingDetails->FiscalCode = 13205628845;
//$CartObj->BillingDetails->TaxOffice = 'Tax Office+ Directorate ıĞüŞöç#102 _Gelir (İdaresi) //Başkanlığı Devlet Mahallesi';
$CartObj->BillingDetails->Address1 = 'Hirohito Blvd 23';
$CartObj->BillingDetails->Address2 = 'floor 5';
$CartObj->BillingDetails->City = $city;
$CartObj->BillingDetails->State = $state;
$CartObj->BillingDetails->CountryCode = $country;
$CartObj->BillingDetails->Phone = $phone; // empty
$CartObj->BillingDetails->Email = 'hitomi@tanaka.co.jp';//"mail463@aPpLe.com";//
$CartObj->BillingDetails->FirstName = 'Hitomi';
$CartObj->BillingDetails->LastName = 'Tanaka';
//$CartObj->BillingDetails->Company = '';
$CartObj->BillingDetails->Zip = 223343;

/**/
$CartObj->DeliveryDetails = new stdClass();
$CartObj->DeliveryDetails->Address1 = 'Hirohito Blvd 23';
$CartObj->DeliveryDetails->Address2 = 'floor 5';
$CartObj->DeliveryDetails->City = $city;
$CartObj->DeliveryDetails->State = $state;
$CartObj->DeliveryDetails->CountryCode = $country;
$CartObj->DeliveryDetails->Phone = $phone;
$CartObj->DeliveryDetails->Email = 'hitomi@tanaka.co.jp';
$CartObj->DeliveryDetails->FirstName = 'Hitomi';
$CartObj->DeliveryDetails->LastName = 'Tanaka';
$CartObj->DeliveryDetails->Zip = 223343;
/**/
$CartObj->PaymentDetails = new stdClass();
//$CartObj->PaymentDetails->Type = "CC";
//$CartObj->PaymentDetails->Type = "ENCRYPTED_PAYMENT_DATA";
//$CartObj->PaymentDetails->Type = "PURCHASEORDER";
//$CartObj->PaymentDetails->Type = "PAYPAL";
//$CartObj->PaymentDetails->Type = "PREVIOUS_ORDER";
//$CartObj->PaymentDetails->Type = "TEST";
//$CartObj->PaymentDetails->Type = "EXISTING_CC";
$CartObj->PaymentDetails->Type = "KONBINI";
$CartObj->PaymentDetails->Currency = $currency;
$CartObj->PaymentDetails->CustomerIP = '91.220.121.21';//"10.10.13.37";

$CartObj->PaymentDetails->PaymentMethod = new stdClass();
//$CartObj->PaymentDetails->PaymentMethod->RecurringEnabled = true;
$CartObj->PaymentDetails->PaymentMethod->RecurringEnabled = false;

/*/
$Payment = new stdClass();
$Payment->Type = 'PAYPAL_EXPRESS';
$Payment->Currency = 'EUR';
$Payment->CustomerIP = '91.220.121.21';
$PayPalExpress = new stdClass();
$PayPalExpress->Email='customer@email.com';
$PayPalExpress->ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php';
$PayPalExpress->CancelURL = 'http://' . $_SERVER['HTTP_HOST'] . '/api/place_order_api_json_paypal_express_response.php' . '?cancel=true';
$Payment->PaymentMethod = $PayPalExpress;
$CartObj->PaymentDetails = $Payment;
/**/

/*/
$CartObj->PaymentDetails->PaymentMethod->RefNo = "11319783"; //6156857 - ogone; 6603292  -payflow; 6448104 - GC; 6564647 - GC fara autoren ; 6616313 - Payflow fara autoren; 6461240 - payflow order by ref; 6477934; 6600777 - paypal fara billing agreement
/**/

//$CartObj->PaymentDetails->PaymentMethod = "Cards";

/*/
$CartObj->PaymentDetails->PaymentMethod->Type = "CC";
$CartObj->PaymentDetails->PaymentMethod->Contents = "nlpv3olqpArhylVORiUk+wjpyyOmn6818XuhJl2jO6n10XNtLFv8g1tDGJbJZCpJ9GJiE2FAudYXB2eGLmgO4wm65Nzs2jaegmhMac4omUkz2Akun9xLBddMPBNiyUWNGCsiSr5nK1DAPXiDhQTceA8nI9hwueQtkSSda3TixvCfgbUuxcrwcMIw7ygUBI/Th49Cjl7a2yyU5Czf/WWSKFbfYIcYPUCucs37A+xGxc7VQvAM5Fa4AZ99ySzpcmTn7oB4sro1Hrz4FtJRmyVmEsTh9JslIzhGhbitUr+LH8FJUYuXVFHXWZUcoyi1S/uo2Ghb6yvX6tknGksluf1z0JfpxfZalhN6+Y1gH+b0/XYGRmHvXTRoYD9S6lGwB8XeSkMFJ7HOp+LtYop3xi4RHgV2ySEprNeoLXPt/+cc6WVICOLj4c1/FNAig3oBYAmg6arlRj7tOFob2BR6mcdIfzag6D5nry7kFNIrffurdfoph2bBVmt2gxnyvGpTq1Uv7Wc7KZV69QRWL44TNXxmvv/OSkUJnZwYKRZQkKGYhhgjBJPsmBoiQLFPLnAMXjDySaWGqRf3zkgXDi3oCqjDmSYCxHZbAvF30kkkZtx+Xl1+ipPUoJTo7pyO6Ibb9fBUjYR+icf/x80w3Qh4ujglEtaBGVAHsXOfsfxv+1qv4D8=";
$CartObj->PaymentDetails->PaymentMethod->Identifier = "public-key-0001";
/**/
/*/
$CartObj->PaymentDetails->PaymentMethod->CardType = "visa";
$CartObj->PaymentDetails->PaymentMethod->CardNumber = "4111111111111111";//4222222222222 //4111111111111111 //4984123412341234 - Installments
$CartObj->PaymentDetails->PaymentMethod->Vendor3DSReturnURL  = 'http://secure.2checkout.com/checkout/external/return/cc';
$CartObj->PaymentDetails->PaymentMethod->Vendor3DSCancelURL  = 'http://secure.2checkout.com/checkout/external/cancel/cc';

//*
$CartObj->PaymentDetails->PaymentMethod->CardNumber = "376411112222331"; //376411112222331 - Installments // 341111111111111
$CartObj->PaymentDetails->PaymentMethod->CardType = "AMEX";/**/
//*/
/*/
$CartObj->PaymentDetails->PaymentMethod->CardNumber = "3566002020360505";
$CartObj->PaymentDetails->PaymentMethod->CardType = "JCB";/**/
/**/

/*/
$CartObj->PaymentDetails->PaymentMethod->CardNumber = "5555555555554444";
$CartObj->PaymentDetails->PaymentMethod->CardType = "cartebleue";
/**/

/*/
$CartObj->PaymentDetails->PaymentMethod->InternalPONumber = 1234;
$CartObj->PaymentDetails->PaymentMethod->AutoApprove = TRUE;
/**/

//$CartObj->PaymentDetails->PaymentMethod->InstallmentsNumber = 1;

/*/
$CartObj->PaymentDetails->PaymentMethod->ExpirationYear = "2019";
$CartObj->PaymentDetails->PaymentMethod->ExpirationMonth = "12";
$CartObj->PaymentDetails->PaymentMethod->CCID = "123";
$CartObj->PaymentDetails->PaymentMethod->HolderName = "Mesut Ozil";
$CartObj->PaymentDetails->PaymentMethod->HolderNameTime = 1;
$CartObj->PaymentDetails->PaymentMethod->CardNumberTime = 1;
/**/

// Retry mechanism for Pending orders
/*/
$RetryOrderInformation = new stdClass();
$RetryOrderInformation->RefNo = '11322054'; // 6206998
$RetryOrderInformation->PaymentDetails = $CartObj->PaymentDetails;

/**/

if ($CartObj->PaymentDetails->Type == 'PREVIOUS_ORDER') {
    $CartObj->ExternalReference ='orderbyref_exteranalref' . $CartObj->PaymentDetails->PaymentMethod->RefNo;
} else if ($CartObj->PaymentDetails->Type == 'PAYPAL') {
    $CartObj->ExternalReference ='orderbyref_exteranalref_PAYPAL';
}


$jsonRpcRequest = new stdClass();
$jsonRpcRequest->jsonrpc = '2.0';
$jsonRpcRequest->method = 'placeOrder';
$jsonRpcRequest->params = array($sessionID, $CartObj);
$jsonRpcRequest->id = $i++;

// Perform the call
$response = callRPC($jsonRpcRequest, $host, true);
print_r(json_encode($response));

 

Response Example

Parameter Type/Description

Order information

Object

  Object containing order information.

 

 

  • Was this article helpful?