API Account information
Endpoint
| HTTP Method | API URL | API Version |
|---|---|---|
| GET | https://connect2.payxpert.com/account | >= 002.60 |
This call permits to a merchant to obtain information about the current API account. Can be used to customize the shopper’s experience according, for example, to payment methods available for the selected currency.
Accepted parameters
| Name | Type | Description | Required | API Version |
|---|---|---|---|---|
| apiVersion | String(8) | API version to be used (default 002.50) | no | >= 002.60 |
Response
The body of the response to a transaction information request is in JSON format.
The following fields are present in the response :
| Name | Type | Description | API Version |
|---|---|---|---|
| apiVersion | String(8) | API version. | >= 002.60 |
| name | String(128) | The displayed name of the account. | >= 002.60 |
| displayTerms | Boolean | Indicates if Terms and conditions must be acknowledged on the payment page by the shopper. | >= 002.60 |
| termsUrl | String(2048) | Terms and conditions URL. | >= 002.60 |
| supportUrl | String(2048) | URL of customer support. | >= 002.60 |
| maxAttempts | Integer | The number of attempts allowed to process the payment in case of failure. | >= 002.60 |
| notificationSenderName | String(100) | Name displayed in customers notification emails. | >= 002.60 |
| notificationSenderEmail | String(100) | Email displayed in customers notification emails. | >= 002.60 |
| notificationOnSuccess | Boolean | Indicates if a notification is sent to the shopper in case of payment success. | >= 002.60 |
| notificationOnFailure | Boolean | Indicates if a notification is sent to the shopper in case of payment failure. | >= 002.60 |
| merchantNotification | Boolean | Indicates if a notification is sent to the merchant after a payment. | >= 002.60 |
| merchantNotificationTo | String(100) | Email used to send merchant notification. | >= 002.60 |
| merchantNotificationLang | String(2) | The language used in merchant email notification (ISO-639 two letters code). | >= 002.60 |
| paymentMethods | Array | A list of payment methods available for the account. See the structure below. | >= 002.60 |
| themes | Array | A list of payment page themes available for the account. See the structure below. | >= 002.73 |
Payment Methods
This contains the information about each payment method available for the account. It contains the following fields:
| Name | Type | Description | API Version |
|---|---|---|---|
| paymentMethod | String(32) | The payment method. See possible values here. | >= 002.60 |
| paymentNetwork | String(32) | The payment network. See possible values here. | >= 002.60 |
| currencies | Array of String(3) | A list of ISO 4217 currency code for which this payment method is enabled. | >= 002.60 |
| defaultOperation | String(32) | The operation that will be executed by default when processing this type of method. Can be sale, authorize or collection | >= 002.60 |
| options | Array of options | A list of payment method specific option. See below for the possible values. | >= 002.60 |
Payment Methods Options
This gives information on options values for specific payment methods.
The object has the following content:
| Name | Type | Description | API Version |
|---|---|---|---|
| name | String(32) | The name of the option | >= 002.60 |
| value | String(1024) | The value of the option | >= 002.60 |
Here the list of possible options according to payment method:
| Payment method | Payment network | Name | Description | API Version |
|---|---|---|---|---|
| CreditCard | 3dsMode | The 3DS mode used in the payment page, possible values: - honor: Honor the 3DS behavior indicated in the transaction request - forbidden: 3DS is forbidden, if the flag is set in the request, it is ignored - try: Always try to use 3DS, if the initial 3DSCheck fails with a 906, process a non-3DS Sale. If the 3DSCheck succeeds and the customer authentication fails, abort the transaction - enforce: Always use 3DS, if the initial 3DSCheck fails or if the 3DSCheck succeeds and the customer authentication fails, abort the transaction - custom: Use the defined custom rules to decide if 3DS must be used or not, 3DS failure will produce a transaction failure (no fallback) |
>= 002.60 |
Themes
This contains the information about the payment page themes available for the account. If several themes are present, the theme ID can be used in the prepare request to use this specific theme.
It contains the following fields:
| Name | Type | Description | API Version |
|---|---|---|---|
| themeId | Integer | The identifier of the theme. To be provided in the prepare request in themeID to use it. | >= 002.73 |
| name | String(64) | The name of the theme for information. | >= 002.73 |
| seamlessLibraries | Array | A list of available Seamless library in this theme. See the structure here. | >= 002.73 |
Themes Seamless Libraries
This gives information on available Seamless libraries in the theme.
The object has the following content:
| Name | Type | Description | API Version |
|---|---|---|---|
| version | String | The version of the Seamless library (i.e. 1.5.0, 1.6.1…) | >= 002.73 |
| hash | String(64) | The value of the SHA384 hash to be used in the javascript integrity attribute | >= 002.73 |
Example JSON
{
"apiVersion": "002.60",
"name": "Example account",
"displayTerms": true,
"termsUrl": "https://example.com/termsandconditions",
"maxAttempts":1,
"notificationSenderName":"Example Merchant",
"notificationSenderEmail":"merchant@example.com",
"notificationOnSuccess":true,
"notificationOnFailure":false,
"merchantNotification":false,
"paymentMethods":[
{
"paymentMethod":"CreditCard",
"currencies":["EUR","USD"],
"defaultOperation":"authorize",
"options": [{"name":"3dsMode","value":"enforce"}]
},
{
"paymentMethod":"BankTransfer",
"paymentNetwork":"sofort",
"currencies":["EUR"],
"defaultOperation":"sale"
},
{
"paymentMethod":"WeChat",
"currencies":["EUR","GBP"],
"defaultOperation":"sale"
}
],
"themes":[
{
"themeId":95,
"name":"Example Theme 95",
"seamlessLibraries":[]
},
{
"themeId":98,
"name":"Example Theme 98 with Seamless",
"seamlessLibraries":[
{
"version":"1.5.0",
"hash":"0IS2bunsGTTsco/UMCa56QRukMlq2pEcjUPMejy6WspCmLpGmsD3z0CmF5LQHF5X"
},
{
"version":"1.6.0",
"hash":"4TOGDPmv7lGP/26T96W371vDxTCsvFOcO947u+WKvweeBIYQKfPhSBGsPhSf1nNR"
}
]
},
]
}
Code samples
use PayXpert\Connect2Pay\Connect2PayClient;
$url = "https://connect2.payxpert.com";
// This will be provided once your account is approved
$originator = "000000";
$password = "Gr3atPassw0rd!";
$c2pClient = new Connect2PayClient($url, $originator, $password);
$info = $c2pClient->getAccountInformation();
if ($info != null) {
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
echo "~~~ API Account information ~~~\n";
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
echo "Account name: " . $info->getName() . "\n";
echo "Display Terms and conditions: " . ($info->getDisplayTerms() ? "yes" : "no") . "\n";
echo "Terms and conditions URL: " . $info->getTermsUrl() . "\n";
echo "Customer support URL: " . $info->getSupportUrl() . "\n";
echo "Number of payment attempts allowed: " . $info->getMaxAttempts() . "\n";
echo "Shopper Email notification on success: " . ($info->getNotificationOnSuccess() ? "yes" : "no") . "\n";
echo "Shopper Email notification on failure: " . ($info->getNotificationOnFailure() ? "yes" : "no") . "\n";
echo "Shopper Email notification sender: " . $info->getNotificationSenderName() . " <" . $info->getNotificationSenderEmail() . ">\n";
echo "Merchant Email notification: " . ($info->getMerchantNotification() ? "yes" : "no") . "\n";
echo "Merchant Email notification recipient: " . $info->getMerchantNotificationTo() . "\n";
echo "Merchant Email notification language: " . $info->getMerchantNotificationLang() . "\n";
if ($info->getPaymentMethods() !== null) {
echo "Enabled Payment Methods information:\n";
foreach ($info->getPaymentMethods() as $methodInfo) {
echo "~~ Payment Method: " . $methodInfo->getPaymentMethod();
if ($methodInfo->getPaymentNetwork() != null) {
echo " via " . $methodInfo->getPaymentNetwork() . " network";
}
echo "\n";
echo "** Currencies: " . implode(', ', $methodInfo->getCurrencies()) . "\n";
echo "** Default operation: " . $methodInfo->getDefaultOperation() . "\n";
if ($methodInfo->getOptions() !== null) {
echo "** Payment Method options:\n";
foreach ($methodInfo->getOptions() as $methodOption) {
echo "*** " . $methodOption->getName() . " => " . $methodOption->getValue() . "\n";
}
}
}
}
} else {
echo "Error: " . $c2pClient->getClientErrorMessage() . "\n";
}
// Instantiate the client and send the transaction information request
// Second argument is the originator ID, third one is the associated API key
Connect2payClient c2p = new Connect2payClient("https://connect2.payxpert.com", "123456", "GreatP4ssw0rd");
AccountInformationRequest request = new AccountInformationRequest();
AccountInformationResponse response = null;
try {
response = c2p.getAccountInformation(request);
if (response != null) {
System.out.println(response.getName());
System.out.println(response.getSupportUrl());
System.out.println(response.getNotificationSenderName());
System.out.println(response.getNotificationSenderEmail());
// ...
List<PaymentMethodInformation> paymentMethods = response.getPaymentMethods();
if (paymentMethods != null) {
for (PaymentMethodInformation paymentMethod : paymentMethods) {
System.out.println(paymentMethod.getPaymentMethod());
System.out.println(paymentMethod.getPaymentNetwork());
System.out.println(paymentMethod.getDefaultOperation());
System.out.println(paymentMethod.getCurrencies().stream().collect(Collectors.joining(", ")));
List<PaymentMethodOption> pmOptions = ccMethod.getOptions();
if (pmOptions != null) {
for (PaymentMethodOption pmOption : pmOptions) {
System.out.println(pmOption.getName() + ": " + pmOption.getValue());
}
}
}
}
// ...
}
} catch (Exception e) {
logger.error("Ooops, an error occurred getting account information: " + e.getMessage());
// Handle the error...
}
const paymentPage = require("payxpert")("123456", "GreatP4ssw0rd").connect2pay;
let accountInformation = await paymentPage.accountInformation();
// Process accountInformation here
console.log("Current API version: " + accountInformation.apiVersion);
var client = new Connect2PayClient(OriginatorConfig.ORIGINATOR_ID, OriginatorConfig.ORIGINATOR_PASSWORD);
var request = client.NewRequestAccountInfo();
var response = await request.Send();
if (response == null)
{
Console.WriteLine("Failure");
} else {
Console.WriteLine("Account info retrieved. Merchant name: " + response.name);
}