SSO by customer reference
Overview
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.
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. |
idCustomer |
Required (string) |
|
Unique customer identifiers. Can be either the ExternalCustomerReference you control or the system-generated AvangateCustomerReference. |
customerType |
Required (string) |
|
Possible values:
|
page |
Optional (string) |
|
The specific myAccount page where you redirect the customer. Possible values: my_subscription - redirect shoppers to the subscription's page of myAccount based on the SubscriptionReference you provide. my_products - redirects shoppers to the myAccount page designed to list all products purchased from 2Checkout. https://store.YourCustomDomain.com/m...t/my_products/? user_data - redirects shoppers to the Personal Information page in myAccount https://store.YourCustomDomain.com/m...unt/user_data/? order_lookup - redirects shoppers to the Order Lookup area of myAccount: https://store.YourCustomDomain.com/m.../order_lookup/ faq - redirects shoppers to the Support page of myAccount https://secure. YourCustomDomain.com/support/ payment_methods – redirect shoppers to the Payment Methods area of myAccount: https://store.YourCustomDomain.com/m...yment_methods/ 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. |
Response
Parameters | 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. |
Request
<?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));