Server SDKs

.NET Integration

Integration

  1. From Visual Studio launch NuGet Package Manager

  2. Search for JudoPay.Net 

  3. Add JudoPay.Net via

    • GUI, or

    • Package Manager Console 

  4. Add the JudoPay.Net package: install-Package JudoPay.Net

 

Setup

  1. Ensure all integration steps are completed.

  2. Add your app’s sandbox Token and Secret:

var client = JudoPaymentsFactory.Create(
    JudoEnvironment.Sandbox,
         <yourApiToken>, 
         <yourApiSecret> 
);

Only sandbox API tokens and secrets will work in the sandbox.
Using the wrong tokens and secrets will result in an authorisation failure.

  1. Ensure the SDK is configured for the sandbox environment.

  2. Use the test cards provided in the Judopay Portal:

    • Tools > Generating transactions

If performing transactions only from your backend, enable the Register Card Transactions permission for your app.
Create a separate app for your backend with the Make Payments permission enabled.

Test all your required payment types in the sandbox environment before going live.

 

PHP Integration

Prerequisites

  • PHP 5.5 and above

  • Composer Package Manager

 

Integration

Using the Composer Package Manager:

  1. Add the Judopay package to your composer.json file:

"require": {        
"judopay/judopay-sdk": "5.0.0"}
  1. Execute: $ composer install

  2. Make the Judopay SDK classes available to your application, by adding the following to your file: require 'vendor/autoload.php';

 

Setup

  1. Create a new Judopay object, with your API credentials:

$judopay = new \Judopay(
    array(
        'apiToken' => 'your-token',
        'apiSecret' => 'your-secret',
        'judoId' => 'your-judo-id',
        //Set to true on production, defaults to false which is the sandbox
        'useProduction' => false
    )
);

For the purpose of this exercise, the sandbox token and secret have been added.

  1. Ensure the SDK is configured for the environment you are targeting.

    • For example, if you are using the sandbox environment: 'useProduction' => false

The Server SDK allows for further configuration:

  • Logging. To help debug you can attach a logger library.

    We recommend Monolog, however any PSR-3 standard library is compatible.

Validation error details can be found in the modelErrors array. For example if a required field is missing from the model.

 

Check Card

Ensure your account supports the Check Card functionality. Contact Developer Support for more details.

 

When making Token Payments, you can obtain the card token from the Check Card response.

Create an instance of the CheckCard Model:

You do not need to set an amount. This is automatically set by Judopay's API in order to check the card

 

 

If result.HasError = false, check the Payment Receipt Model response

 

Register Card

Use registerCard to save the consumer's card details in Judopay's card vault.

When making Token Payments, you can obtain the card token from the Register Card response

Create an instance of the RegisterCard Model

 

You do not need to set an amount. This is automatically set by Judopay's Transaction API in order to register the card.
The receipt response will show the payment: Type = PreAuth.

 

 

If result.HasError = false, check the Payment Receipt Model response.

 

Save Card

Use saveCard to save the consumer's card details in Judopay's card vault.

When making Token Payments, you can obtain the card token from the Save Card response.

 

Create an instance of the SaveCardModel:

 

 

If result.HasError = false, check the Payment Receipt Model response.

 

Token Payments

You can create a token payment following a: Payment | PreAuth | Register Card | Save Card operation, as a card token is always returned

 

Create an instance of the TokenPaymentModel:

 

 

Check the Payment Receipt Model response.

 

Creating a PreAuth

Create an instance of the CardPaymentModel:

 

 

Check the Payment Receipt Model response.

 

Creating a Collection

Partial collections are supported. Use the same ReceiptId to collect different amounts up to the original preauth amount.
You cannot collect more than the original amount.

 

Following the preAuth, prepare the collection:

 

 

Check the response: Payment Receipt Model.

 

Creating a Payment

When handling exceptions, it is good practice to use Try Catch Block.

 

Create an instance of the CardPaymentModel:

 

 

If response.HasError = false, check the Payment Receipt Model response.

 

3D Secure 2 Transaction Flow

Authenticate a 3D Secure 2 transaction to allow for additional transaction checks required for compliance with Strong Customer Authentication (SCA).

For more information on 3D Secure 2 and SCA, see What is Strong Customer Authentication?

Make sure your account has 3D Secure enabled. Contact ​Customer Support​​ to set this up.

 

The instance of the CardPaymentModel you created for Creating a Payment, just needs the following additional 3D Secure 2 parameters to be included:

 

 

If no additional transaction checks are required, you will receive the usual paymentReceipt response.
If additional transaction checks are required, you will receive the challenge response.

 

 

 

Check the Payment Receipt Model response.

 

Payment Receipt Model

 

Creating a Refund

You can process a full or partial refund.

Ensure the Refund Payments permission is enabled on your API token.

 

Create a refund request:

 

 

If response.HasError = false, check the Payment Receipt Model response.

 

Going Live

Test all your required transaction types in the live environment before deploying your app.

You will need to have tested your app in the sandbox environment before going live.

 

1. Activate your Account

  • To process live payments, ensure you have a live account.

  • Complete the activation form for us to make the necessary changes to your account. 

We will contact you as soon as you are live.

2. Point to the Live Environment

 

  • Replace your sandbox API Token and Secret for the live API Token and Secret 

    • Find these in Judopay Portal > Your apps > {app name} > Live Tokens

3. Test Live Payments

  • Ensure the SDK is properly configured for the live environment

  • Use real debit or credit cards

    • Test cards provided will not work in live

    • We recommend to perform pre-authorizations followed by a void, or regular payments followed by a refund 

    • Send a refund through the  Judopay PortalHistory

  • Test all payment scenarios and security features to verify the expected behaviour