API Account information

Endpoints

HTTP Method API URL API Version
GET https://paiement.payzone.ma/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 payment cancel 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

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.structure below. >= 002.60


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

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"
        }
    ]
}
                

Code samples

       
    use PayXpert\Connect2Pay\Connect2PayClient;

    $url = "https://paiement.payzone.ma";
    // 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://paiement.payzone.ma", "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);
    }
                        

© Payzone | 2023