Quick Guide

  1. Set up your merchant group account at https://dashboard.xiippy.ai/ A merchant group is a group of logically connected merchants, like members of a franchise. An independent merchant can be deemed a merchant group with a single member. Members of a merchant group (e.g. franchisees) should be invited by the head of group to create their accounts at https://dashboard.xiippy.ai/ManageEnterprise.

  2. Set up your merchant account at https://dashboard.xiippy.ai/SetupMerchantAccount

  3. Choose between a self-deployed instance of the SDK Bridge (which will have its own URL), or alternatively, use the cloud-based one at https://sdkbridge.xiippy.ai/

  4. Log into the SDK Bridge instance using its URL and follow the prompts to create the cryptographic keys which will be used to transfer end-to-end encrypted data to the payers from the SDK Bridge instance, as well as to digitally-signed itemized invoices and receipts, as well as to create the 4 parameters that Xiippy's lightweight SDK requires to interact with the SDK Bridge instance and process payments using it, as follows:

    1. A Merchant Group ID,

    2. A Merchant ID,

    3. A Base URL (which is normally the URL of the SDK Bridge instance you are interacting with)

    4. A Secret Key (which has to be treated like a secret and maintained only at server-side with proper provisions and care applicable to secrets, never to be sent to client side)

  5. Pick a relevant SDK for your desired software stack and include Xiippy's lightweight SDKs. We recommend you to use one of the available sample apps to get started quickly. All you need is the source code and the 4 config items that you need to set in the sample apps to run it and succesfully initiate your first payments.

git clone https://github.com/Xiippy/XiippySDKBridgeSampleAspNetApp
  1. Alternatively, follow the next steps by integrating the SDK with your existing payment pages by installing Xiippy's lightweight SDK packages

dotnet add package Xiippy.POSeComSDK.Light
  1. On your main payments page, include Xiippy's main client-side scripts

<script src="https://cdn.xiippy.ai/PaymentScripts/app.XiippyFrameSDK.bundle.js"></script>
  1. Include the necessary JavaScript code on your page

      @{if (!string.IsNullOrEmpty(Model.ErrorText))
        {
            <div class="alert alert-danger alert-dismissible fade show text-break" role="alert">
                <p><strong>Error</strong></p>
                <p>     @Model.ErrorText</p>
                <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                    <span aria-hidden="true"></span>
                </button>
            </div>
        }
    }


                
                <div id="frameContainer" style="width:100%; margin:0 auto 0 auto; min-height:300"></div>
                <div id="diverror" style="width:100%; margin:0 auto 0 auto;"></div>
                <script>
                    function initXiippyFrameSDK() {

                        // initialize parameters
                        var FrameContainerID = 'frameContainer';
                        // this parameter is generated by Xiippy's server-side SDK and has to be set from the server
                        var Url = '<%- Model.XiippyFrameUrl %>';
                        var sdkInstance = new XiippyFrameSDK.XiippyFrameSDK(FrameContainerID, Url);

                        // listen for events
                        sdkInstance.on('PaymentProcessed', (eventArgs) => {
                            // you need to implement payment success logic here
                            console.log('PaymentProcessed event was fired!', eventArgs);
                        });

                        sdkInstance.on('PaymentError', (eventArgs) => {
                            // you need to implement retrying or error handling logic here!
                            console.log('PaymentError event was fired!', eventArgs);

                            document.getElementById('diverror').innerText = eventArgs?.eventArgs?.error?.message;
                        });

                    }

                    // initialize the SDK upon page load
                    window.addEventListener("load", () => initXiippyFrameSDK(), false);
                </script>
  1. On the back-end, on the payment page, include the right dependencies from the lightweight SDK.

using Xiippy.POSeComSDK.Light.Models;
using Xiippy.POSeComSDK.Light.XiippySDKBridgeApiClient;
  1. On the back-end, upon the initialization of the payment page, initialize the payment process by passing the right Merchant Group ID, Merchant ID, Base Address and Secret Key to the lightweight SDK functions.

/// <summary>
/// Page initialization
/// </summary>
/// <returns></returns>
public async Task<IActionResult> OnGetAsync()
{
    try
    {
        // try initiating the payment and loading the payment card screen
        XiippyFrameUrl = await InitiatePaymentAndGetiFrameUrlAsync();

    }
    catch (Exception x)
    {
        // show the error message, if any
        ErrorText = x.ToString();
    }

    return Page();
}


/// <summary>
/// Initiate the payment flow and get the URL to be loaded in the iFrame
/// </summary>
/// <returns></returns>
public async Task<string> InitiatePaymentAndGetiFrameUrlAsync()
{
    // depending on the basket, shipping and billing address entered, as well as amounts, the payment is initialized:
    string StatementID = Guid.NewGuid().ToString();
    string UniqueStatementID = Guid.NewGuid().ToString();
    PaymentProcessingRequest req = new PaymentProcessingRequest
    {
        MerchantGroupID = config.MerchantGroupID,
        MerchantID = config.MerchantID,
        Amount = 2.5F,
        Currency = "aud",
        ExternalUniqueID = UniqueStatementID,
        IsPreAuth = false,
        IsViaTerminal = false,
        // customer is optional
        Customer = new PaymentRecordCustomer
        {
            CustomerAddress = new PaymentRecordCustomerAddress
            {
                CityOrSuburb = "Brisbane",
                Country = "Australia",
                FullName = "Full Name",
                Line1 = "100 Queen St",
                PhoneNumber = "+61400000000",
                PostalCode = "4000",
                StateOrPrivince = "Qld"
            },
            CustomerEmail = "dont@contact.me",
            CustomerName = "Full Name",
            CustomerPhone = "+61400000000"

        },
        IssuerStatementRecord = new IssuerStatementRecord
        {
            // this could be a different id than RandomStatementID which is a Xiippy identifier
            UniqueStatementID = UniqueStatementID,
            RandomStatementID = StatementID,
            StatementCreationDate = DateTime.Now.ToUniversalTime().Ticks.ToString(),
            StatementTimeStamp = DateTime.Now.ToString("yyyyMMddHHmmss"),

            Description = "Test transaction #1",
            DetailsInBodyBeforeItems = "Description on the receipt before items",
            DetailsInBodyAfterItems = "Description on the receipt after items",
            DetailsInFooter = "Description on the footer",
            DetailsInHeader = "Description on the header",
            StatementItems = new List<StatementItem>
            {
                new StatementItem
                {

                    Description = "Description",
                    UnitPrice = 11,
                    Url = "Url",
                    Quantity = 1,
                    Identifier = "Identifier",
                    Tax=1,
                    TotalPrice=11


                },
                new StatementItem
                {
                    Description = "Description2",
                    UnitPrice = 33,
                    Url = "Url2",
                    Quantity =1,
                    Identifier = "Identifier2",
                    Tax=3,
                    TotalPrice=33,

                }


            },

            TotalAmount = 44,
            TotalTaxAmount = 4
        }



    };


    // instantiate the SDK objects and feed them with the right parameters
    XiippySDKBridgeApiClient client = new XiippySDKBridgeApiClient(true, config.Config_ApiSecretKey, config.Config_BaseAddress, config.MerchantID, config.MerchantGroupID);
    // initiate the payment
    var response = await client.InitiateXiippyPayment(req);

    string QueryString = Utils.Utils.BuildQueryString(new Dictionary<string, string>
    {
        {Constants.QueryStringParam_rsid,response.RandomStatementID },
        {Constants.QueryStringParam_sts,response.StatementTimeStamp },
        {Constants.QueryStringParam_ca,response.ClientAuthenticator },
        {Constants.QueryStringParam_spw,"true" }, // show plain view
        {Constants.QueryStringParam_MerchantID,  config.MerchantID},
        {Constants.QueryStringParam_MerchantGroupID,  config.MerchantGroupID}, // important
        {Constants.QueryStringParam_cs,response.ClientSecret },
        {Constants.QueryStringParam_ShowLongXiippyText,"true" }, // show the long xiippy description text
        

    });

    string FullPaymentPageUrl = $"{config.Config_BaseAddress}/Payments/Process?{QueryString}";
    Debug.WriteLine($"The payment page can not be browsed at '{FullPaymentPageUrl}'");
    return FullPaymentPageUrl;
}

 /// <summary>
 /// Refunds a payment with RandomStatementID and StatementTimeStamp
 /// </summary>
 /// <param name="RandomStatementID"></param>
 /// <param name="StatementTimeStamp"></param>
 /// <param name="AmountInDollars">Optional, when null passed, refunds the full amount otherwise has to be smaller than the transaction amount</param>
 /// <returns></returns>
 public async Task RefundPaymentAsync(string RandomStatementID, string StatementTimeStamp, float? AmountInDollars)
 {


     RefundCardPaymentRequest req = new RefundCardPaymentRequest
     {

         MerchantGroupID = config.MerchantGroupID,
         MerchantID = config.MerchantID,
         RandomStatementID = RandomStatementID,
         StatementTimestamp = StatementTimeStamp,
         AmountInDollars= AmountInDollars
     };


     // instantiate the SDK objects and feed them with the right parameters
     XiippySDKBridgeApiClient client = new XiippySDKBridgeApiClient(true, config.Config_ApiSecretKey, config.Config_BaseAddress, config.MerchantID, config.MerchantGroupID);
     // initiate the payment
     var response = await client.RefundCardPayment(req);
     ProcessedMessage = @$"Refund was processed successfully. Response:\r\n{System.Text.Json.JsonSerializer.Serialize(response)}";

 }

Last updated