Home

Awesome

Integration with Skyflow

The module implements integration with Skyflow: Data Privacy Vault service.

Key Features:

Prerequisites:

  1. Skyflow Account: Ensure you have created and configured your Skyflow Account to leverage the full capabilities of the module.
  2. Authorize.NET Account: Similarly, create and configure your Authorize.NET Account for seamless integration with the module.
  3. Installation: Simply install the Skyflow Module to start harnessing its powerful features and functionalities.

Architecture

image-20240124-131429

  1. Order Placement:
  1. Credit Card Payment Form:
  1. Tokenization Process:
  1. Transaction Processing:
  1. Payment Document Creation:
  1. Saved Credit Card:

Setup

This setup documentation provides step-by-step instructions for secure payment processing by integrating Skyflow with Virto Commerce.

Skyflow Configuration

Import vault schema

  1. Sign in to Skyflow Studio.
  2. On the home screen with the list of vaults. Select Add vault-> upload vault schema
  3. Upload the default vault schema vaultSchema.json

Roles Creation

The main security recommendation is to have two service accounts with different roles for saving and tokenizing card data in the vault and for executing outbound connections. In the next steps, create the two new roles:

  1. 'Integrations invoker' role with the folowing policies
ALLOW READ ON credit_cards.* WITH REDACTION = DEFAULT
ALLOW TOKENIZATION ON credit_cards.*
ALLOW READ ON credit_cards.card_expiration WITH REDACTION = PLAIN_TEXT
  1. 'Vault writer' role with the folowing policies
ALLOW CREATE ON credit_cards.*
ALLOW TOKENIZATION ON credit_cards.*

Service Accounts Creation

Create the two service accounts Vault -> Service Accounts -> Add Service Account

  1. Use name Payment form account and assign the role Vault writer.
  2. Use name Integrations account and assign the role Integrations invoker. Download the credentials.json files for each service account and keep them on the secure place.

Creating Authorize.NET Skyflow Connection

  1. In the Skyflow studio open Vault -> Connections -> Add connection
  2. Use the https://apitest.authorize.net as outbound base url
  3. Use the POST /xml/v1/request.api endpoint for route
  4. Select content type XML
  5. For the request body set these fields and actions
    1. createTransactionRequest.transactionRequest.payment.creditCard.cardNumber - Detokenization
    2. createTransactionRequest.transactionRequest.payment.creditCard.cardCode - Detokenization
    3. createTransactionRequest.transactionRequest.payment.creditCard.expirationDate - Detokenization
  6. Assign Integrations account service account to this connection

Virto Commerce Configuration

Appsettings.json Configuration

Configure Skyflow Settings: - Update the appsettings.json file with Skyflow configuration under Payments:Skyflow section:

Configuration example.

{
  "Payments": {
    "Skyflow": {
      "tokenURI": "https://manage.skyflowapis-preview.com/v1/auth/sa/oauth/token",
      "vaultURI": "https://a370a9658141.vault.skyflowapis-preview.com",
      "gatewayURI": "https://a370a9658141.gateway.skyflowapis-preview.com",
      "vaultId": "ff9fc275bec848318361cc8928e094d1",
      "tableName": "credit_cards",
      "PaymentFormAccount": {
        "clientID": "j873500104e6439bbbeb8cec63a6d21",
        "keyID": "a70d977de5f24532810df376585031aa",
        "privateKey": "-----BEGIN PRIVATE KEY-----Base64-----END PRIVATE KEY-----"
      },
      "IntegrationsAccount": {
        "clientID": "b47bea9c61c74cf4aac3b26d09aaf825",
        "keyID": "c950c459157548f0817500288ec8ac96",
        "privateKey": "-----BEGIN PRIVATE KEY-----Base64-----END PRIVATE KEY-----"
      },
      "TargetPaymentMethod": "AuthorizeNetPaymentMethod",
      "TargetConnectionRoute": "b47bea9c61c74cf4aac3b26d09aaf825/xml/v1/request.api"

    }
  }
}
 public override PostProcessPaymentRequestResult PostProcessPayment(PostProcessPaymentRequest request)
   {
....
       if (request.Parameters["CreditCard"] != null)
       {
           var tokenizedCard = JsonConvert.DeserializeObject<dynamic>(request.Parameters["CreditCard"]);
           creditCard = new AuthorizeNetCreditCard
           {
               CardCode = tokenizedCard.Cvv,
               CardNumber = tokenizedCard.CardNumber,
               ExpirationDate = tokenizedCard.CardExpiration,
               ProxyEndpointUrl = request.Parameters["ProxyEndpointUrl"],
               ProxyHttpClientName = request.Parameters["ProxyHttpClientName"]
           };

          using var stream = new MemoryStream();
          var proxyHttpClient = _httpClientFactory.CreateClient(request.CreditCard.ProxyHttpClientName);
          var xmlSerializer = new XmlSerializer(typeof(AuthorizeNetCreateTransactionRequest));
          using var xmlWriter = XmlWriter.Create(stream, new XmlWriterSettings
          {
              Encoding = new UTF8Encoding(false, true), //Exclude BOM
              Indent = true,
          });
          xmlSerializer.Serialize(xmlWriter, this);
          using var content = new StreamContent(stream);
          content.Headers.ContentType = new MediaTypeHeaderValue(MediaTypeNames.Application.Xml);
          var proxyRequest = new HttpRequestMessage(HttpMethod.Post, new Uri(request.CreditCard.ProxyEndpointUrl))
          {
              Content = content
          };
          var response = proxyHttpClient.Send(proxyRequest);
       }

Customization

Integration with Payment Providers:

Module.cs

 public void Initialize(IServiceCollection serviceCollection)
{
...
 serviceCollection.AddTransient<SkyflowPaymentMethod, SkyflowPaymentMethod2>();
 ...
}

References

License

Copyright (c) Virto Solutions LTD. All rights reserved.

Licensed under the Virto Commerce Open Software License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://virtocommerce.com/opensourcelicense

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.