Swinto-Payment Gateway

Swinto-Payment Gateway

Required Field Names

We require you to send the following fields when initiating a payment:

Example JSON Payload

Here’s a sample JSON object combining all required fields. Remember to adjust values according to your environment.

{
  "email": "merchant@example.com",     // Merchant credentials
  "password": "SecretPass123",         // Merchant credentials

  "account": "1167243219",            // Client's SWINTO account
  "full_name": "John Doe",            // Client's full name

  "description": "Example payment transaction",
  "failurl": "https://yoursite.com/payment-fail",
  "okurl": "https://yoursite.com/payment-success",
  "amount": "50.00"
}
    
  

Encryption

As before, you must **encrypt** this JSON object with our public key before sending it. Below is a sample PHP function demonstrating how to do this using openssl_public_encrypt.

public function encrypt($decryptedData): ?string
{
    // Path to your public key
    $publicKey = file_get_contents('/public.key');

    // Load the key
    $pubKey = openssl_pkey_get_public($publicKey);
    if ($pubKey === false) {
        return "Failed to load public key!";
    }

    // Encrypt the JSON string
    $encrypted = '';
    if (!openssl_public_encrypt(json_encode($decryptedData), $encrypted, $pubKey)) {
        return "Failed to encrypt data! " . openssl_error_string();
    }

    // Cleanup
    openssl_free_key($pubKey);

    // Return base64 encoded ciphertext
    return base64_encode($encrypted);
}
  

Updated Form Snippet

In your frontend (or server-side form), you will only post encrypted data. The original (plain text) fields are commented out for clarity.

<form id="form" method="post" action="/payment">
    <!--
      
      
      
      
      
      
      
      

      Collect these above fields in your application,
      then encrypt them using our public key.
    -->

    <input
      type="text"
      class="form-control"
      placeholder="encrypted"
      name="encrypted"
      value="<?= $yourEncryptedPayload ?>"
    >

    <button type="submit">test</button>
</form>
  

Process Overview

  1. Gather required fields: email, password, account, full_name, amount, description, failurl, okurl.
  2. Encrypt the entire JSON object: use our provided public key to ensure your transaction data is secure in transit.
  3. Submit your form: place the resulting base64 cipher string in name="encrypted" and POST to /payment.
  4. Gateway handles decryption & payment: we decrypt your data server-side, authenticate, and process the transaction.
Need assistance? If you have any questions about the updated fields or the encryption process, please contact our support team at anel.murselji@nexthrone.com.