SSO by customer reference

Use the getSingleSignOnByCustomer method to create Single Sign-On links into 2Checkout myAccount based on customer references (IDs). Use either the Avangate Customer Reference or the External Customer Reference to identify specific customers.

Request parameters

Parameter
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.

idCustomer

Required (string)

Unique customer identifiers. Can be either the ExternalCustomerReference you control or the system-generated AvangateCustomerReference.

customerType

Required (string) Possible values:

  • ExternalCustomerReference

  • AvangateCustomerReference

page

The specific myAccount page where you redirect the customer.

Possible values:

Do not include PAGE in the URL to redirect shoppers to myAccount homepage https://store.YourCustomDomain.com/myaccount/?

request

Optional (string)

Needed for 'my_subscription'. Request[]=code=123D40F123 redirects customers to the page for the subscription with the 123D40F123 SubscriptionReference value.

validityTime

Optional (int)

The time, in seconds, before the single sign-on URL expires. By default, the URL expires after 10 seconds. (optional)

validationIp

Optional (string)

The IP address of the shopper, necessary for security purposes. Can be an empty string or a valid IP, or null.

Request sample

<?php
require('PATH_TO_AUTH');

$idCustomer = '352365983';
$customerType = 'AvangateCustomerReference';
$page = 'my_license';
$request = null;
$validityTime = 50;
$validationIp = null;
$languageCode = 'en';

$jsonRpcRequest = [\
    'method' => 'getSingleSignOnByCustomer',\
    'params' => [\
        $sessionID,\
        $idCustomer,\
        $customerType,\
        $page,\
        $request,\
        $validityTime,\
        $validationIp,\
        $languageCode // optional\
    ],\
    'id' => $i++,\
    'jsonrpc' => '2.0',\
];

var_dump(callRPC((object)$jsonRpcRequest, $host, true));

Response parameters

Parameter
Type / Description

Single sign-on URL

String

The string generated is the complete single sign-on URL pointing to 2Checkout myAccount, containing the unique URL. Shoppers using it log into their 2Checkout myAccount automatically.

Last updated

Was this helpful?