Server SDKs
Server SDK Integration

.NET and PHP Integrations

.NET and PHP SDKs

Integration

.NET
PHP
  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

For examples on integrating with the .NET Server SDK, see our sample app for more information.



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

Setup

.NET
PHP
  1. Ensure all integration steps are completed.
  2. Add your app’s sandbox Token and Secret: var client = JudoPaymentsFactory.Create( JudoEnvironment.Sandbox, <yourApiToken>, <yourApiSecret> );
  3. Ensure the SDK is configured for the sandbox environment.
  4. Use the test cards provided in the Judopay Portal:
    • Tools > Generating transactions

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. For our DotNetSDK core sample app, see DotNetSDK.



The Server SDK allows for further configuration: Logging To help debug you can attach a logger library. Validation error details can be found in the modelErrors array. For example if a required field is missing from the model.

Other Payment Methods using the Server SDKs To send payment requests with the wallet details from Apple Pay™ and Google Pay™, see our Transaction API for more information.



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:

.NET
PHP


You do not need to set an amount. This is automatically set by Judopay's Transaction 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:

.NET
PHP


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.

Parameter

Description

yourConsumerReference String Required

Unique reference to anonymously identify your customer. Advisable to use GUIDs. Must be below 40 characters.

yourPaymentReference String Required

Judopay's Server SDK sets this value automatically. If you insert a value, the SDK will change it. This value is unique in order to protect your customers against duplicate transactions.

yourPaymentMetaData IDictionary Optional

Additional information associated with a transaction to help reconcile.

judoId String Required

Unique ID supplied by Judopay. Specific to a merchant and/or location. Format:

  • 100100100
  • Maximum length 9 characters.
  • Do not include spaces or dashes.

cardNumber String Required

Submitted without whitespace or non-numeric characters.

currency String Optional





The currency of the transaction.

Any ISO 4217 alphabetic currency code:

  • GBP
  • USD
  • EUR

cv2 String Required



The 3 or 4 digit number on the back of a credit card.

Also known as the card verification value (CVV) or security code.

startDate String Optional

For Maestro cards: Format:

  • MM/YY

expiryDate String Optional

The expiry date of the card. Format:

  • MM/YY

issueNumber Integer Optional

For Maestro cards:

  • A number between 1 and 2 digits (from 0 to 99).
  • Located on the front of the card.

initialRecurringPayment Boolean Optional

Indicates if this initial payment is part of a recurring payment.

recurringPayment Boolean Optional

Indicates if this is a recurring payment.

relatedReceiptId String Optional



The receiptId returned from the first subscription payment.

Adding the relatedReceiptId references the subsequent recurring transactions to the original transaction.

threeDSecure Object Required

For any 3D Secure 2 requests. authenticationSource indicates the type of channel used to initiate the transaction. Format:

  • enum

Values:

  • Unknown
  • Browser
  • Merchant_Initiated
  • Mobile_Sdk

challengeRequestIndicator

Indicates the type of 3D Secure 2 challenge request. Format:

  • enum

Values:

  • noPreference
  • noChallenge
    • No challenge required.
  • challengePreferred
    • A challenge is preferred for this transaction.
  • challengeAsMandate
    • Must challenge this transaction.

scaExemption

The customer initiated transaction type, that is exempt from SCA. Format:

  • enum

Values:

  • LowValue
    • Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.
  • SecureCorporate
    • Request exemption for payments made using a corporate card.
  • TrustedBeneficiary
    • Provides the cardholder the option to add the merchant to their trusted list.
  • TransactionRiskAnalysis
    • Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed.

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:

.NET
PHP



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



Token Payments

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

Create an instance of the TokenPaymentModel:

.NET
PHP



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



Creating a PreAuth

Create an instance of the CardPayment Model:

.NET
PHP



If result.HasError = false, 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:

.NET
PHP



Check the Payment Receipt Model response.



Voiding a PreAuth Transaction

Cancel a pre-authorised transaction if the funds have not yet settled.

Voids cannot be performed on transactions that have been collected (partial or full).

Create a void request:

.NET
PHP



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



Creating a Payment

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

Create an instance of the CardPayment Model:

.NET
PHP



If result.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?



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

.NET
PHP


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



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:

.NET
PHP



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
.NET
PHP

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 Portal > History.
  • Test all payment scenarios and security features to verify the expected behaviour.