---
title: .NET Integration
slug: net-and-php-integrations
docTags: 
createdAt: 2024-05-23T14:33:49.184Z
---

## Integration

1. From Visual Studio launch: **NuGet Package Manager**
2. Search for JudoPay.Net&#x20;
3. Add JudoPay.Net via
   - GUI, or
   - Package Manager Console&#x20;
4. Add the JudoPay.Net package:
   `install-Package JudoPay.Net`

For examples on integrating with the .NET Server SDK, see our [sample app](https://github.com/JudoPay/DotNetSDK) for more information.

***

:::hint{type="warning"}
Only sandbox API tokens and secrets will work in the sandbox.
Using the wrong tokens and secrets will result in an **authorisation failure**.
:::

## 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> `
   `);`
3. Ensure the SDK is configured for the sandbox environment.
4. Use the test cards provided in the Judopay Portal:
   - **Tools** > **Generating transactions**

:::hint{type="info"}
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](https://github.com/Judopay/DotNetSDK/tree/8d5385d271aea93b1fa7b1bb04ca5546358d8c8a).

***

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.&#x20;
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](docId\:bcXNM5keOk-nlNrZTafUT) for more information.

***

## Check Card

:::hint{type="warning"}
Ensure your account supports the Check Card functionality.&#x20;
Contact [Developer Support](mailto\:developersupport@judopay.com) for more details.
:::

:::hint{type="info"}
When making [Token Payments](docId\:hNgLLJxESInHS7PtfEvTN), you can obtain the **card token** from the Check Card response.
:::

**Create an instance of the CheckCard Model**:

:::CodeblockTabs
.NET

```apex
//Create an instance of the CheckCard Model
var checkCardRequest = new CheckCardModel
{
    JudoId = "yourJudoId",
    YourConsumerReference = "yourConsumerReference",
    YourPaymentReference = "yourPaymentReference",
    CardNumber = "4976000000003436",
    ExpiryDate = "12/30",
    CV2 = "452",
    CardAddress = new CardAddressModel
    {
        Address1 = "41 Luke St",
        PostCode = "EC2A 4DP",
        Town = "London",
        CountryCode = 826
    },
    // PrimaryAccountDetails only required for MCC6012 MCC6051 MCC7299 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    },
    // Following are for 3DS2 transactions
    PhoneCountryCode = "44",
    MobileNumber = "7999123456",
    EmailAddress = "test.user@judopay.com",
    CardHolderName = "John Smith",
    ThreeDSecure = new ThreeDSecureTwoModel
    {
        AuthenticationSource = ThreeDSecureTwoAuthenticationSource.Browser,
        ChallengeRequestIndicator = ThreeDSecureTwoChallengeRequestIndicator.ChallengeAsMandate,
        MethodNotificationUrl = "https://yourMethodNotificationUrl",
        ChallengeNotificationUrl = "https://yourChallengeNotificationUrl"
    }
};

//Send the request to Judopay
var response = await client.CheckCards.Create(checkCardRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentRequiresThreeDSecureTwoModel threeDSecureTwoResponseModel)
{
    if (threeDSecureTwoResponseModel.MethodUrl != null)
    {
        // Device details are required - POST md as threeDSMethodData to methodUrl
        var methodUrl = threeDSecureTwoResponseModel.MethodUrl;
        var md = threeDSecureTwoResponseModel.Md;
    }
    else if (threeDSecureTwoResponseModel.ChallengeUrl != null)
    {
        // Challenge is required - POST creq to challengeUrl
        var challengeUrl = threeDSecureTwoResponseModel.ChallengeUrl;
        var creq = threeDSecureTwoResponseModel.CReq;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
    if (receipt.Result == "Success")
    {
        var cardToken = receipt.CardDetails.CardToken;
    }
}
```
:::

:::hint{type="info"}
You do not need to set an amount.&#x20;
This is automatically set by Judopay's Transaction API in order to check the card.
:::

:::hint{type="warning"}
**\*Mastercard Recommends:**
These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied.&#x20;
See, [Mastercard Recommended 3D Secure 2 Fields](docId\:WpFMF662qaIGEGrpU_Mow).
:::

| **Parameter**                                                                                                        | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `judoId`<br />String<br /><font color="#ef5b2e">Required</font><br /><br />                                          | Unique ID supplied by Judopay.<br />Specific to a merchant and/or location.<br />Format:<br />- 100100100<br />- Maximum length 9 characters.<br />- Do not include spaces or dashes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `yourConsumerReference`<br />String<br /><font color="#ef5b2e">Required</font><br />                                 | Unique reference to anonymously identify your customer.<br />Advisable to use GUIDs.<br />Must be below 40 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `yourPaymentReference`<br />String<br /><font color="#ef5b2e">Required</font><br />                                  | Your unique reference for this payment.<br />Format:<br />- Maximum length 50 characters.<br />This value should be unique in order to protect your customers against duplicate transactions. <br />With a server side integration, if a payment reference is not supplied, the transaction will not be processed.                                                                                                                                                                                                                                                                                                                                         |
| `phoneCountryCode`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br />   | The country code of the consumer's phone.<br />Format:<br />- Maximum length 3 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **mobileNumber** is set.<br />If not set, default = 44                                                                                                                                                                                                                                                                                                                                                                                                     |
| `mobileNumber`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br /><br /> | Consumer’s valid mobile number.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.<br />Format:<br />- Maximum length 15 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **phoneCountryCode** is set.                                                                                                                                                                                                                                                                                                        |
| `cardHolderName`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br />     | The card name of the consumer<br />If the cardHolderName field is displayed to the user in the payment form (**isCardHolderNameVisible: true&#x20;**&#x69;s set in the iFrame config), the value entered in the payment form will overwrite this value.                                                                                                                                                                                                                                                                                                                                                                                                    |
| `challengeRequestIndicator`<br />String<br /><font color="#42cbd4">Optional</font><br /><br />                       | Indicates the type of challenge request you wish to apply.<br />Set this to one of the following strings:<br />- `noPreference`<br />- `noChallenge`<br />- No challenge required.<br />- `challengePreferred`<br />- A challenge is preferred for this transaction.<br />- `challengeAsMandate`<br />- Must challenge this transaction.<br />This **should not&#x20;**&#x62;e included in the same configuration object as **scaExemption**.                                                                                                                                                                                                              |
| `scaExemption`<br />String<br /><font color="#42cbd4">Optional</font><br /><br />                                    | To apply for an exemption from SCA, for a customer initiated transaction.<br />Set this to one of the following strings:<br />- `lowValue`<br />- Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.<br />- `trustedBeneficiary`<br />- Provides the cardholder the option to add the merchant to their trusted list.<br />- `transactionRiskAnalysis`<br />- Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed.<br />This **should not** be included in the same configuration object as **challengeRequestIndicator**. |
| `initialRecurringPayment`<br />Boolean<br /><font color="#42cbd4">Optional</font>                                    | Indicates if this initial payment is part of a recurring payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `billingAddress`<br />Object<br /><font color="#42cbd4">Optional</font><br /><br />                                  | Card holder's billing address.<br />Properties:<br />- `address1` <font color="#ef5b2e">(</font><font color="#ef5b2e">Recommended)</font><font color="#ef5b2e">\*</font><br />- `address2` (optional)<br />- `town`<br />- `state`(only required if country is USA/Canada)<br />- Format:<br />- string<br />- ISO Alpha-2 Code (e.g. California = "**CA**")<br />- `country`<br />- Format:<br />- string<br />- See [here](docId\:XZE369mFK5UVOSaNzM8UO) for the list of valid **ISO 3166-1** format country codes.<br />- `postCode`<br />If the billingAddress is provided, the postcode is **required**.                                              |
| `emailAddress`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font>             | Consumer’s valid email address.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Save Card

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

:::hint{type="info"}
When making [Token Payments](docId\:hNgLLJxESInHS7PtfEvTN), you can obtain the **card token** from the Save Card response.
:::

**Create an instance of the SaveCardModel**:

:::CodeblockTabs
.NET

```apex
//Create an instance of the SaveCardModel
var saveCardRequest = new SaveCardModel()
{
    JudoId = "yourJudoId",
    YourConsumerReference = "yourConsumerReference",
    CardNumber = "4976000000003436",
    ExpiryDate = "12/30"
};
 
//Send the request to Judopay
var response = await client.SaveCards.Create(saveCardRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
    if (receipt.Result == "Success")
    {
        var cardToken = receipt.CardDetails.CardToken;
    }
}
```
:::

:::hint{type="warning"}
**\*Mastercard Recommends:**
These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied.&#x20;
See, [Mastercard Recommended 3D Secure 2 Fields](docId\:WpFMF662qaIGEGrpU_Mow).
:::

| **Parameter**                                                                                              | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ---------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `cardNumber`<br />String<br /><font color="#ef5b2e">Required</font>                                        | Submitted without whitespace or non-numeric characters.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `expiryDate`<br />String<br /><font color="#42cbd4">Optional</font>                                        | The expiry date of the card.<br />Format:<br />- MM/YY                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `cardAddress`<br />Object<br /><font color="#ef5b2e">Re</font><font color="#ef5b2e">commended \*</font>    | Card holder's address.<br />Values:<br />- `address1` <font color="#ef5b2e">(</font><font color="#ef5b2e">Recommended)</font><font color="#ef5b2e">\*</font><br />- `address2` (optional)<br />- `town`<br />- `state` (only required if country is USA/Canada)<br />- `country`<br />See [here](docId\:XZE369mFK5UVOSaNzM8UO) for the list of valid **ISO 3166-1** format country codes.<br />- `postcode`<br />If the cardAddress is provided, the postcode is **required**. |
| `startDate`<br />String<br /><font color="#42cbd4">Optional</font>                                         | For Maestro cards:<br />Format:<br />- MM/YY                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `issueNumber`<br />Integer<br /><font color="#42cbd4">Optional</font>                                      | For Maestro cards:<br />- A number between 1 and 2 digits (from 0 to 99).<br />- Located on the front of the card.                                                                                                                                                                                                                                                                                                                                                             |
| `yourConsumerReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>                  | Unique reference to anonymously identify your customer.<br />Advisable to use GUIDs.<br />Must be below 40 characters.                                                                                                                                                                                                                                                                                                                                                         |
| `judoId`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>                                 | Unique ID supplied by Judopay.<br />Specific to a merchant and/or location.<br />Format:<br />- 100100100<br />- Maximum length 9 characters.<br />- Do not include spaces or dashes.                                                                                                                                                                                                                                                                                          |
| `currency`<br />String<br /><font color="#42cbd4">Optional</font>                                          | The currency of the transaction. <br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR                                                                                                                                                                                                                                                                                                                                                                 |
| `cardHolderName`<br />String<br /><font color="#ef5b2e">Re</font><font color="#ef5b2e">commended \*</font> | The card name of the consumer.                                                                                                                                                                                                                                                                                                                                                                                                                                                 |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Token Payments

:::hint{type="info"}
You can create a token payment following a: **Payment&#x20;**| **PreAuth&#x20;**| **Save Card** operation, as a **card token** is always returned.
:::

**Create an instance of the TokenPaymentModel**:

:::CodeblockTabs
.NET

```apex
//Create an instance of the TokenPaymentModel Model
var tokenPaymentRequest = new TokenPaymentModel
{
    JudoId = "yourJudoId",
    YourConsumerReference = "yourConsumerReference",
    YourPaymentReference = "yourPaymentReference",
    CardToken = "cardTokenFromPreviousTransaction",
    // CV2 only required if required by your gateway
    CV2 = "452",
    Amount = 1.01m,
    Currency = "GBP",
    CardAddress = new CardAddressModel
    {
        Address1 = "41 Luke St",
        PostCode = "EC2A 4DP",
        Town = "London",
        CountryCode = 826
    },
    // PrimaryAccountDetails only required for MCC6012 MCC6051 MCC7299 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    },
    // Following are for 3DS2 customer-initiated transactions
    PhoneCountryCode = "44",
    MobileNumber = "7999123456",
    EmailAddress = "test.user@judopay.com",
    CardHolderName = "John Smith",
    ThreeDSecure = new ThreeDSecureTwoModel
    {
        AuthenticationSource = ThreeDSecureTwoAuthenticationSource.Browser,
        ChallengeRequestIndicator = ThreeDSecureTwoChallengeRequestIndicator.ChallengeAsMandate,
        MethodNotificationUrl = "https://yourMethodNotificationUrl",
        ChallengeNotificationUrl = "https://yourChallengeNotificationUrl"
    },
    // Following are for merchant-initiated transactions
    RecurringPayment = true,
    RecurringPaymentType = RecurringPaymentType.Mit, // Unscheduled, use Recurring for scheduled payments
    RelatedReceiptId = "receiptIdOfOriginalCustomerInitiatedTransaction"
};

//Send the request to Judopay
var response = await client.Payments.Create(tokenPaymentRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentRequiresThreeDSecureTwoModel threeDSecureTwoResponseModel)
{
    if (threeDSecureTwoResponseModel.MethodUrl != null)
    {
        // Device details are required - POST md as threeDSMethodData to methodUrl
        var methodUrl = threeDSecureTwoResponseModel.MethodUrl;
        var md = threeDSecureTwoResponseModel.Md;
    }
    else if (threeDSecureTwoResponseModel.ChallengeUrl != null)
    {
        // Challenge is required - POST creq to challengeUrl
        var challengeUrl = threeDSecureTwoResponseModel.ChallengeUrl;
        var creq = threeDSecureTwoResponseModel.CReq;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
    if (receipt.Result == "Success")
    {
        var cardToken = receipt.CardDetails.CardToken;
    }
}
```
:::

:::hint{type="warning"}
**\*Mastercard Recommends:**
These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied.&#x20;
See, [Mastercard Recommended 3D Secure 2 Fields](docId\:WpFMF662qaIGEGrpU_Mow).
:::

| **Parameter**                                                                               | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cardToken`<br />String<br /><font color="#ef5b2e">Required</font>                          | Save the cardToken into your database to send back to Judopay, instead of inserting the consumer's card details.                                                                                                                                                                                                                                                                                                                                                                          |
| `yourConsumerReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>   | Unique reference to anonymously identify your customer.<br />Advisable to use GUIDs.<br />This must match the original **yourConsumerReference** when the token was initially created.                                                                                                                                                                                                                                                                                                    |
| `yourPaymentReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>    | Set your unique reference for this payment.<br />Format:<br />- Maximum length 50 characters.<br />- This value should be unique in order to protect your customers against duplicate transactions.<br />- With a server side integration, if a payment reference is not supplied, the transaction will not be processed.                                                                                                                                                                 |
| `yourPaymentMetaData`&#xD;<br />IDictionary<br /><font color="#42cbd4">Optional</font>      | Additional information associated with a transaction to help reconcile.                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `judoId`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>                  | Unique ID supplied by Judopay.<br />Specific to a merchant and/or location.<br />Format:<br />- 100100100<br />- Maximum length 9 characters.<br />- Do not include spaces or dashes.                                                                                                                                                                                                                                                                                                     |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font><br /><br />                | The amount to process.<br />Format:<br />- Two decimal places<br />- For currencies using a different structure please contact Judopay for support.                                                                                                                                                                                                                                                                                                                                       |
| `currency`<br />String<br /><font color="#42cbd4">Optional</font>                           | The currency of the transaction. <br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR                                                                                                                                                                                                                                                                                                                                                                            |
| `userAgent`<br />String<br /><font color="#42cbd4">Optional</font>                          | Consumer's browser details.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `deviceCategory`<br />String<br /><font color="#42cbd4">Optional</font>                     | The type of device where the consumer is carrying out the transaction:<br />- Mobile                                                                                                                                                                                                                                                                                                                                                                                                      |
| `acceptHeaders`<br />String<br /><font color="#42cbd4">Optional</font>                      | Consumer's browser details.                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `cardAddress`<br />Object<br /><font color="#42cbd4">Optional</font><br />                  | Card holder's billing address.<br />Values:<br />- `address1` <font color="#ef5b2e">(</font><font color="#ef5b2e">Recommended)</font><font color="#ef5b2e">\*</font><br />- `address2 `(optional)<br />- `town`<br />- `state` (only required if country is USA/Canada)<br />- `country`<br />See [here](docId\:XZE369mFK5UVOSaNzM8UO) for the list of valid **ISO 3166-1** format country codes.<br />- `postcode`<br />If the billingAddress is provided, the postcode is **required**. |
| `initialRecurringPayment`<br />Boolean<br /><font color="#42cbd4">Optional</font>           | Indicates if this initial payment is part of a recurring payment.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `recurringPayment`<br />Boolean<br /><font color="#42cbd4">Optional</font>                  | Indicates if this is a recurring payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `recurringPaymentType`<br />enum<br /><font color="#42cbd4">Optional</font><br /><br />**** | Type of recurring payment.<br />Values:<br />- **RECURRING**<br />Scheduled regular payment.<br />- **MIT&#x20;**(Merchant Initiated Transaction) Unscheduled regular payment.<br />If a value is not set, the default value = **RECURRING**                                                                                                                                                                                                                                              |
| `relatedReceiptId`<br />String<br /><font color="#42cbd4">Optional</font><br />             | The receiptId returned from the first subscription payment.<br />Adding the relatedReceiptId references the subsequent recurring transactions to the original transaction.                                                                                                                                                                                                                                                                                                                |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Creating a PreAuth

**Create an instance of the CardPayment Model**:

:::CodeblockTabs
.NET

```apex
//Create an instance of the CardPayment Model
var preauthRequest = new CardPaymentModel
{
    JudoId = "yourJudoId",
    YourConsumerReference = "yourConsumerReference",
    YourPaymentReference = "yourPaymentReference",
    CardNumber = "4976000000003436",
    ExpiryDate = "12/30",
    CV2 = "452",
    Amount = 1.01m,
    Currency = "GBP",

    CardAddress = new CardAddressModel
    {
        Address1 = "41 Luke St",
        PostCode = "EC2A 4DP",
        Town = "London",
        CountryCode = 826
    },

    // PrimaryAccountDetails only required for MCC6012, MCC6051 and MCC7299 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    },

    // AFT fields only required for supported AFT merchants
    // BusinessApplicationId and AccountType values vary by scheme and acquirer configuration
    BusinessApplicationId = "AA",

    AftRecipientInformation = new AftRecipientInformationModel
    {
        FirstName = "John",
        AddressLine1 = "Smith House",
        CountryCode = "GB",
        AccountId = "5432101111",
        AccountType = "03"
    },

    // Following are for 3DS2 transactions
    PhoneCountryCode = "44",
    MobileNumber = "7999123456",
    EmailAddress = "test.user@judopay.com",
    CardHolderName = "John Smith",

    ThreeDSecure = new ThreeDSecureTwoModel
    {
        AuthenticationSource = ThreeDSecureTwoAuthenticationSource.Browser,
        ChallengeRequestIndicator = ThreeDSecureTwoChallengeRequestIndicator.ChallengeAsMandate,
        MethodNotificationUrl = "https://yourMethodNotificationUrl",
        ChallengeNotificationUrl = "https://yourChallengeNotificationUrl"
    }
};

//Send the request to Judopay
var response = await client.PreAuths.Create(preauthRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentRequiresThreeDSecureTwoModel threeDSecureTwoResponseModel)
{
    if (threeDSecureTwoResponseModel.MethodUrl != null)
    {
        // Device details are required - POST md as threeDSMethodData to methodUrl
        var methodUrl = threeDSecureTwoResponseModel.MethodUrl;
        var md = threeDSecureTwoResponseModel.Md;
    }
    else if (threeDSecureTwoResponseModel.ChallengeUrl != null)
    {
        // Challenge is required - POST creq to challengeUrl
        var challengeUrl = threeDSecureTwoResponseModel.ChallengeUrl;
        var creq = threeDSecureTwoResponseModel.CReq;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;

    if (receipt.Result == "Success")
    {
        var cardToken = receipt.CardDetails.CardToken;
    }
}
```
:::

:::hint{type="warning"}
**\*Mastercard Recommends:**
These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied.&#x20;
See, [Mastercard Recommended 3D Secure 2 Fields](docId\:WpFMF662qaIGEGrpU_Mow).
:::

| **Parameter**                                                                                                            | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `judoId`<br />String<br /><font color="#ef5b2e">Required</font><br /><br />                                              | Unique ID supplied by Judopay.<br />Specific to a merchant and/or location.<br />Format:<br />- 100100100<br />- Maximum length 9 characters.<br />- Do not include spaces or dashes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font><br /><br />                                             | The amount to process.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `currency`<br />String<br /><font color="#ef5b2e">Required</font><br />                                                  | The currency of the transaction.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `yourConsumerReference`<br />String<br /><font color="#ef5b2e">Required</font>                                           | Unique reference to anonymously identify your customer.<br />Advisable to use GUIDs.<br />Must be below 40 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `yourPaymentReference`<br />String<br /><font color="#ff6900">Required</font><br /><br />                                | Your unique reference for this payment.<br />Format:<br />- Maximum length 50 characters.<br />This value should be unique in order to protect your customers against duplicate transactions. <br />With a server side integration, if a payment reference is not supplied, the transaction will not be processed.                                                                                                                                                                                                                                                                                                                                                          |
| `phoneCountryCode`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br /><br /> | The country code of the consumer's phone.<br />Format:<br />- Maximum length 3 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **mobileNumber** is set.<br />If not set, default = 44                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `mobileNumber`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br /><br />     | Consumer’s valid mobile number.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.<br />Format:<br />- Maximum length 15 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **phoneCountryCode** is set.                                                                                                                                                                                                                                                                                                                         |
| `cardHolderName`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br />         | The card name of the consumer.<br />If the cardHolderName field is displayed to the user in the payment form (**isCardHolderNameVisible: true** is set in the iFrame config), the value entered in the payment form will overwrite this value.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `challengeRequestIndicator`<br />String<br /><font color="#42cbd4">Optional</font><br /><br /><br />                     | Indicates the type of challenge request you wish to apply.<br />Set this to one of the following strings:<br />- `noPreference`<br />- `noChallenge`<br />- No challenge required.<br />- `challengePreferred`<br />- A challenge is preferred for this transaction.<br />- `challengeAsMandate`<br />- Must challenge this transaction.<br />This **should not&#x20;**&#x62;e included in the same configuration object as **scaExemption**.                                                                                                                                                                                                                               |
| `scaExemption`<br />String<br /><font color="#42cbd4">Optional</font><br /><br />                                        | To apply for an exemption from SCA, for a customer initiated transaction.<br />Set this to one of the following strings:<br />- `lowValue`<br />- Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.<br />- `trustedBeneficiary`<br />- Provides the cardholder the option to add the merchant to their trusted list.<br />- `transactionRiskAnalysis`<br />- Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed.<br />This **should not** be included in the same configuration object as **challengeRequestIndicator**.                  |
| `initialRecurringPayment`<br />Boolean<br /><font color="#42cbd4">Optional</font>                                        | Indicates if this initial payment is part of a recurring payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `billingAddress`<br />Object<br /><font color="#42cbd4">Optional</font><br /><br />                                      | Card holder's billing address.<br />Properties:<br />- `address1` <font color="#ef5b2e">(</font><font color="#ef5b2e">Recommended)</font><font color="#ef5b2e">\*</font><br />- `address2` (optional)<br />- `town`<br />- `state` (only required if country is USA/Canada)<br />- Format:<br />- string<br />- ISO Alpha-2 Code (e.g. California = "**CA**")<br />- `country`<br />- Format:<br />- string<br />- See [here](docId\:XZE369mFK5UVOSaNzM8UO) for the list of valid **ISO 3166-1** format country codes.<br />- `postCode`<br />If the billingAddress is provided, the postcode is **required**.                                                              |
| `emailAddress`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font>                 | Consumer’s valid email address.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `primaryAccountDetails`<br />Object<br /><font color="#42cbd4">Optional</font><br /><br />                               | This is **Mandatory&#x20;**&#x66;or merchants who have an MCC code of **6012**, **6051&#x20;**&#x61;nd **7299**.<br />Properties:<br />- `name`<br />**This is the surname.**<br />- `accountNumber`<br />- `postCode`<br />- `dateOfBirth`<br />- Format: YYYY-MM-DD                                                                                                                                                                                                                                                                                                                                                                                                       |
| `businessApplicationId`<br />String<br /><font color="#A5F3FC">Optional</font>                                           | **Required for AFT transactions**.<br />Identifies the type / purpose of the transaction.<br />Format:<br />- Maximum 2 characters<br />Values:**&#xD;**<br />AA – Account to account<br />FD – Funds disbursement<br />FT – Funds transfer<br />PD – Payroll<br />TU – Top up<br />WT – Digital wallet<br />- **Account Type**<br />Indicates the recipient's account type.****<br />Select from the following values:<br />- 00 - Other<br />- 01 - TRN & BAN<br />- 02 - IBAN<br />- 03 - Card (first6 & last4)<br />- 06 - BAN & BIC (SWIFT code)<br />**Note**: If `businessApplicationId` is provided, `aftRecipientInformation` **must&#x20;**&#x61;lso be provided. |
| `aftRecipientInformation`<br />Object<br /><font color="#A5F3FC">Optional</font>                                         | **Required for AFT transactions**.<br />Contains recipient details.<br /><br />**Note**: If `aftRecipientInformation` is provided, `businessApplicationId` **must&#x20;**&#x61;lso be provided.<br />Values:<br />`firstName`<br />Recipient’s first name.<br />`addressLine1`<br />Recipient’s address line 1.<br />`countryCode`<br />ISO 3166-1 alpha-2 country code.<br />`accountType`<br />Type of recipient account.<br />`accountId`<br />Unique identifier of the recipient account.<br />For more information, see [Account Funding Transactions](docId:5ol_pTSGBHVGKwJwD0gHg).                                                                                   |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Creating a Collection

:::hint{type="info"}
Partial collections are supported.&#x20;
Use the same **ReceiptId&#x20;**&#x74;o collect different amounts up to the original preauth amount.
**You cannot collect more than the original amount**.
:::

**Following the&#x20;**[preAuth](docId\:hNgLLJxESInHS7PtfEvTN)**, prepare the collection**:

:::CodeblockTabs
.NET

```apex
// Create an instance of the Collection model
var collectionRequest = new CollectionModel()
{
    ReceiptId = yourPreauthReceiptId,
    Amount = 1.01m // Optional, if not specified full preauth amount will be collected
};

//Send the request to Judopay
var response = await client.Collections.Create(collectionRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
}
```
:::

| **Parameter**                                                                            | **Description**                                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `receiptId`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>             | Judopay's reference for the pre authorisation that is to be collected.                                                                                                                                                                 |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font>                         | The amount to collect must not exceed the amount of the original pre authorisation.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                         |
| `currency`<br />String<br /><font color="#ef5b2e">Required</font>                        | If specified, the currency must match the original pre authorisation.<br />If not specified, the currency of the original pre authorisation will be used.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR |
| `yourPaymentReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font> | Your unique reference for this collection.<br />Format:<br />- Maximum length 50 characters.<br />**This is not the yourPaymentReference of the original pre authorisation**.                                                          |
| `yourPaymentMetaData`<br />String<br /><font color="#42cbd4">Optional</font><br />       | Key-value map for additional metadata associated with this transaction.<br />Will be stored but not processed or passed to gateways.<br />Do not include sensitive information like card numbers.                                      |

Check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Voiding a PreAuth Transaction

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

:::hint{type="warning"}
Voids cannot be performed on transactions that have been collected (partial or full).
:::

**Create a void request**:

:::CodeblockTabs
.NET

```apex
// Create an instance of the Void model
var voidRequest = new VoidModel()
{
    ReceiptId = yourPreauthReceiptId
};

//Send the request to Judopay
var response = await client.Voids.Create(voidRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
}
```
:::

| **Parameter**                                                                            | **Description**                                                                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `receiptId`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font>             | Judopay's reference for the pre authorisation that is to be voided.                                                                                                                                                                    |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font>                         | The amount to void.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                                                                                         |
| `currency`<br />String<br /><font color="#ef5b2e">Required</font>                        | If specified, the currency must match the original pre authorisation.<br />If not specified, the currency of the original pre authorisation will be used.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR |
| `yourPaymentReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font> | Your unique reference for this void.<br />Format:<br />- Maximum length 50 characters.<br />**This is not the yourPaymentReference of the original pre authorisation**.                                                                |
| `yourPaymentMetaData`<br />String<br /><font color="#42cbd4">Optional</font><br />       | Key-value map for additional metadata associated with this transaction.<br />Will be stored but not processed or passed to gateways.<br />Do not include sensitive information like card numbers.                                      |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Creating a Payment

### Account Funding Transactions

Account Funding Transactions (AFT) are **required&#x20;**&#x66;or merchants operating in specific **money movement and financial services categories**, as defined by card schemes.
For more information, see ***[Applicable Merchants](docId:5ol_pTSGBHVGKwJwD0gHg).***

For these merchants, additional data **must be** included in the [payment session](docId\:ylKW5coh5NQnfQ3j_Wjk2) and payment requests to ensure transactions are processed in line with scheme and acquirer requirements.
For more information, see [Account Funding Transactions](docId:5ol_pTSGBHVGKwJwD0gHg).

:::hint{type="warning"}
To submit Account Funding Transactions you are using Judopay's API version **6.25&#x20;**&#x6F;r higher.
:::

***

**To Create a Payment:**

- Create an instance of the CardPayment Model:

:::hint{type="info"}
When handling exceptions, it is good practice to use Try Catch Block.
:::

:::CodeblockTabs
.NET

```apex
//Create an instance of the CardPayment Model
var paymentRequest = new CardPaymentModel
{
    JudoId = "yourJudoId",
    YourConsumerReference = "yourConsumerReference",
    YourPaymentReference = "yourPaymentReference",
    CardNumber = "4976000000003436",
    ExpiryDate = "12/30",
    CV2 = "452",
    Amount = 1.01m,
    Currency = "GBP",

    CardAddress = new CardAddressModel
    {
        Address1 = "41 Luke St",
        PostCode = "EC2A 4DP",
        Town = "London",
        CountryCode = 826
    },

    // PrimaryAccountDetails only required for MCC6012, MCC6051 and MCC7299 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    },

    // AFT fields only required for supported AFT merchants
    // BusinessApplicationId and AccountType values vary by scheme and acquirer configuration
    BusinessApplicationId = "AA",

    AftRecipientInformation = new AftRecipientInformationModel
    {
        FirstName = "John",
        AddressLine1 = "Smith House",
        CountryCode = "GB",
        AccountId = "5432101111",
        AccountType = "03"
    },

    // Following are for 3DS2 transactions
    PhoneCountryCode = "44",
    MobileNumber = "7999123456",
    EmailAddress = "test.user@judopay.com",
    CardHolderName = "John Smith",

    ThreeDSecure = new ThreeDSecureTwoModel
    {
        AuthenticationSource = ThreeDSecureTwoAuthenticationSource.Browser,
        ChallengeRequestIndicator = ThreeDSecureTwoChallengeRequestIndicator.ChallengeAsMandate,
        MethodNotificationUrl = "https://yourMethodNotificationUrl",
        ChallengeNotificationUrl = "https://yourChallengeNotificationUrl"
    }
};

//Send the request to Judopay
var response = await client.Payments.Create(paymentRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentRequiresThreeDSecureTwoModel threeDSecureTwoResponseModel)
{
    if (threeDSecureTwoResponseModel.MethodUrl != null)
    {
        // Device details are required - POST md as threeDSMethodData to methodUrl
        var methodUrl = threeDSecureTwoResponseModel.MethodUrl;
        var md = threeDSecureTwoResponseModel.Md;
    }
    else if (threeDSecureTwoResponseModel.ChallengeUrl != null)
    {
        // Challenge is required - POST creq to challengeUrl
        var challengeUrl = threeDSecureTwoResponseModel.ChallengeUrl;
        var creq = threeDSecureTwoResponseModel.CReq;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;

    if (receipt.Result == "Success")
    {
        var cardToken = receipt.CardDetails.CardToken;
    }
}
```
:::

:::hint{type="warning"}
**\*Mastercard Recommends:**
These fields are recommended rather than mandatory. Transactions will continue to be processed if not supplied.&#x20;
See, [Mastercard Recommended 3D Secure 2 Fields](docId\:WpFMF662qaIGEGrpU_Mow).
:::

| **Parameter**                                                                                                            | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `judoId`<br />String<br /><font color="#ef5b2e">Required</font><br /><br />                                              | Unique ID supplied by Judopay.<br />Specific to a merchant and/or location.<br />Format:<br />- 100100100<br />- Maximum length 9 characters.<br />- Do not include spaces or dashes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font><br /><br />                                             | The amount to process.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `currency`<br />String<br /><font color="#ef5b2e">Required</font><br />                                                  | The currency of the transaction.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `yourConsumerReference`<br />String<br /><font color="#ef5b2e">Required</font>                                           | Unique reference to anonymously identify your customer.<br />Advisable to use GUIDs.<br />Must be below 40 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `yourPaymentReference`<br />String<br /><font color="#ff6900">Required</font><br /><br />                                | Your unique reference for this payment.<br />Format:<br />- Maximum length 50 characters.<br />This value should be unique in order to protect your customers against duplicate transactions. <br />With a server side integration, if a payment reference is not supplied, the transaction will not be processed.                                                                                                                                                                                                                                                                                                                                                          |
| `phoneCountryCode`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br /><br /> | The country code of the consumer's phone.<br />Format:<br />- Maximum length 3 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **mobileNumber** is set.<br />If not set, default = 44                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `mobileNumber`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br /><br />     | Consumer’s valid mobile number.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.<br />Format:<br />- Maximum length 15 characters.<br />- Only numbers allowed.<br />- Do not include special characters or spaces.<br />Must be set if **phoneCountryCode** is set.                                                                                                                                                                                                                                                                                                                         |
| `cardHolderName`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font><br />         | The card name of the consumer.<br />If the cardHolderName field is displayed to the user in the payment form (**isCardHolderNameVisible: true** is set in the iFrame config), the value entered in the payment form will overwrite this value.                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `challengeRequestIndicator`<br />String<br /><font color="#42cbd4">Optional</font><br /><br /><br />                     | Indicates the type of challenge request you wish to apply.<br />Set this to one of the following strings:<br />- `noPreference`<br />- `noChallenge`<br />- No challenge required.<br />- `challengePreferred`<br />- A challenge is preferred for this transaction.<br />- `challengeAsMandate`<br />- Must challenge this transaction.<br />This **should not&#x20;**&#x62;e included in the same configuration object as **scaExemption**.                                                                                                                                                                                                                               |
| `scaExemption`<br />String<br /><font color="#42cbd4">Optional</font><br /><br />                                        | To apply for an exemption from SCA, for a customer initiated transaction.<br />Set this to one of the following strings:<br />- `lowValue`<br />- Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.<br />- `trustedBeneficiary`<br />- Provides the cardholder the option to add the merchant to their trusted list.<br />- `transactionRiskAnalysis`<br />- Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed.<br />This **should not** be included in the same configuration object as **challengeRequestIndicator**.                  |
| `initialRecurringPayment`<br />Boolean<br /><font color="#42cbd4">Optional</font>                                        | Indicates if this initial payment is part of a recurring payment.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `billingAddress`<br />Object<br /><font color="#42cbd4">Optional</font><br /><br />                                      | Card holder's billing address.<br />Properties:<br />- `address1` <font color="#ef5b2e">(</font><font color="#ef5b2e">Recommended)</font><font color="#ef5b2e">\*</font><br />- `address2` (optional)<br />- `town`<br />- `state` (only required if country is USA/Canada)<br />- Format:<br />- string<br />- ISO Alpha-2 Code (e.g. California = "**CA**")<br />- `country`<br />- Format:<br />- string<br />- See [here](docId\:XZE369mFK5UVOSaNzM8UO) for the list of valid **ISO 3166-1** format country codes.<br />- `postCode`<br />If the billingAddress is provided, the postcode is **required**.                                                              |
| `emailAddress`<br />String<br /><font color="#ef5b2e">Recommended</font> <font color="#ef5b2e">\*</font>                 | Consumer’s valid email address.<br /><br />Mastercard recommends providing at least **one contact method** for Mastercard 3D Secure authenticated transactions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `primaryAccountDetails`<br />Object<br /><font color="#42cbd4">Optional</font><br /><br />                               | This is **Mandatory&#x20;**&#x66;or merchants who have an MCC code of **6012**, **6051&#x20;**&#x61;nd **7299**.<br />Properties:<br />- `name`<br />**This is the surname.**<br />- `accountNumber`<br />- `postCode`<br />- `dateOfBirth`<br />- Format: YYYY-MM-DD                                                                                                                                                                                                                                                                                                                                                                                                       |
| `businessApplicationId`<br />String<br /><font color="#A5F3FC">Optional</font>                                           | **Required for AFT transactions**.<br />Identifies the type / purpose of the transaction.<br />Format:<br />- Maximum 2 characters<br />Values:**&#xD;**<br />AA – Account to account<br />FD – Funds disbursement<br />FT – Funds transfer<br />PD – Payroll<br />TU – Top up<br />WT – Digital wallet<br />- **Account Type**<br />Indicates the recipient's account type.****<br />Select from the following values:<br />- 00 - Other<br />- 01 - TRN & BAN<br />- 02 - IBAN<br />- 03 - Card (first6 & last4)<br />- 06 - BAN & BIC (SWIFT code)<br />**Note**: If `businessApplicationId` is provided, `aftRecipientInformation` **must&#x20;**&#x61;lso be provided. |
| `aftRecipientInformation`<br />Object<br /><font color="#A5F3FC">Optional</font>                                         | **Required for AFT transactions**.<br />Contains recipient details.<br /><br />**Note**: If `aftRecipientInformation` is provided, `businessApplicationId` **must&#x20;**&#x61;lso be provided.<br />Values:<br />`firstName`<br />Recipient’s first name.<br />`addressLine1`<br />Recipient’s address line 1.<br />`countryCode`<br />ISO 3166-1 alpha-2 country code.<br />`accountType`<br />Type of recipient account.<br />`accountId`<br />Unique identifier of the recipient account.<br />For more information, see [Account Funding Transactions](docId:5ol_pTSGBHVGKwJwD0gHg).                                                                                   |

If **result.HasError = false**, check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## 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).&#x20;
For more information on 3D Secure 2 and SCA, see [Managing SCA Compliance](docId\:uLg1uCaYg3ljb7t0SVcw5).

:::hint{type="warning"}
Make sure your account has **3D Secure 2 API credentials&#x20;**&#x65;nabled.&#x20;
Contact ​Customer Support​​ to set this up.
:::

The instance of the **CardPaymentModel** you created for [Creating a Payment](docId\:hNgLLJxESInHS7PtfEvTN), just needs the following **additional 3D Secure 2 parameters** to be included:

:::CodeblockTabs
.NET

```apex
// See Payment, PreAuth sections for details of how to trigger an initial transaction with required 3DS2 attributes

// If the response indicated device details check are required, POST the returned md (as an attribute named
// threeDSMethodData) to the returned methodUrl, and wait for a call from ACS to the methodNotificationUrl supplied on
// the initial transaction

// Once the call to the methodNotificationUrl has been received, create an instance of the ResumeThreeDSecureTwo Model
var resumeThreeDsRequest = new ResumeThreeDSecureTwoModel()
{
    MethodCompletion = MethodCompletion.Yes,
    CV2 = "452",
    // PrimaryAccountDetails only required for MCC6012, MCC6051 and MCC7299 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    },
};
    
// Use the ReceiptId from the original transaction response
var resumeResponse = await client.ThreeDs.Resume3DSecureTwo(result.Response.ReceiptId, resumeThreeDsRequest);
    
if (resumeResponse.HasError)
{
    if (resumeResponse.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (resumeResponse.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = resumeResponse.Error.Code;
    }
}
else if (resumeResponse.Response is PaymentRequiresThreeDSecureTwoModel resumeChallengeRequiredModel)
{
    // Challenge is required - POST creq to challengeUrl
    var challengeUrl = resumeChallengeRequiredModel.ChallengeUrl;
    var creq = resumeChallengeRequiredModel.CReq;
}
else if (resumeResponse.Response is PaymentReceiptModel resumeReceipt)
{
    // Transaction has been processed
    var receiptId = resumeReceipt.ReceiptId;
    var status = resumeReceipt.Result;
}



// If either the initial transaction response, or the resume response, indicated a challenge is required, POST the
// returned creq to the returned challengeUrl, and wait for a call from ACS to the challengeNotificationUrl supplied on
// the initial transaction

// Once the call to the challengeNotificationUrl has been received, create an instance of the CompleteThreeDSecureTwo
// Model
var completeThreeDsRequest = new CompleteThreeDSecureTwoModel()
{
    CV2 = "452",
    // PrimaryAccountDetails only required for MCC6051 MCC7299 MCC6012 merchants
    PrimaryAccountDetails = new PrimaryAccountDetailsModel
    {
        Name = "Smith",
        AccountNumber = "1234567",
        DateOfBirth = "2000-12-31",
        PostCode = "EC2A 4DP"
    }
};
    
// Use the ReceiptId from the original transaction response
var completeResponse = await client.ThreeDs.Complete3DSecureTwo(result.Response.ReceiptId, completeThreeDsRequest);
    
if (completeResponse.HasError)
{
    if (completeResponse.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (completeResponse.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = completeResponse.Error.Code;
    }
}
else if (resumeResponse.Response is PaymentReceiptModel completeReceipt)
{
    // Transaction has been processed
    var receiptId = completeReceipt.ReceiptId;
    var status = completeReceipt.Result;
}
```
:::

:::ExpandableHeading
### Additional 3D Secure 2 Parameters

| **Parameter**                                                             | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cardHolderName`<br />String<br /><font color="#bf5b2e">Required</font>   | The full name of the card holder.<br />**When testing in the sandbox environment, it is the cardHolderName that is used to determine the test card for 3D Secure 2 authentication.**<br />Format:<br />- Alphanumeric<br />- Length: 2-45 characters<br />- Allowed special characters: \[.-'␣]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `mobileNumber`<br />String<br /><font color="#42cbd4">Optional</font>     | Consumer’s valid UK mobile number.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `phoneCountryCode`<br />String<br /><font color="#42cbd4">Optional</font> | The country code of the consumer's phone.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `emailAddress`<br />String<br /><font color="#42cbd4">Optional</font>     | Consumer’s valid email address.<br />**It is recommended but not required for 3D Secure 2 authentication.**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `threeDSecure`<br />Object<br /><font color="#bf5b2e">Required</font>     | For any 3D Secure 2 requests.<br />`authenticationSource` indicates the type of channel used to initiate the transaction.<br />Format:<br />- enum<br />Values:<br />- Unknown<br />- Browser<br />- Merchant\_Initiated<br />- Mobile\_Sdk<br />`challengeRequestIndicator` indicates the type of 3D Secure 2 challenge request.<br />Format:<br />- enum<br />Values:<br />- `noPreference`<br />- `noChallenge`<br />- No challenge required.<br />- `challengePreferred`<br />- A challenge is preferred for this transaction.<br />- `challengeAsMandate`<br />- Must challenge this transaction.<br />`scaExemption` The customer initiated transaction type, that is exempt from SCA.<br />Format:<br />- enum<br />Values:<br />- `LowValue`<br />- Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.<br />- `TrustedBeneficiary`<br />- Provides the cardholder the option to add the merchant to their trusted list.<br />- `TransactionRiskAnalysis`<br />- Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed.<br /><br />Make sure when testing:<br />- `methodNotificationUrl`<br />and<br />- `challengeNotificationUrl`<br />you use a **real URL** for the values.<br />**If you use a localhost URL, it will not work**.<br />`methodNotificationUrl` The URL that will receive the method completion message, confirming the Issuer has completed the device details check.<br />- URL<br />- Length: 1-256 characters<br />`challengeNotificationUrl` The URL that will receive the outcome of the challenge request to the consumer.<br />- URL<br />- Length: 1-256 characters |


:::

If no additional transaction checks are required, you will receive the usual **paymentReceipt&#x20;**&#x72;esponse.

If additional transaction checks are required, you will receive the **challenge&#x20;**&#x72;esponse.

:::ExpandableHeading
### ResumeThreeDSecureTwo Model Parameters

| **Parameter**                                                                  | **Description**                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cv2`<br />String<br /><font color="#bf5b2e">Required</font>                   | The 3 or 4 digit number on the back of a credit card.<br />Also known as the card verification value (CVV) or security code.                                                                                                                                          |
| `primaryAccountDetails`<br />Object<br /><font color="#42cbd4">Optional</font> | For **MCC 6012, 6051&#x20;**&#x61;nd **7299&#x20;**&#x6D;erchants, this object needs to be added to the request. Without this, 3D Secure 2 transactions **will not** be successful.<br /> Values:<br />- name<br />- accountNumber<br />- dateOfBirth<br />- postCode |
| `methodCompletion`<br />enum<br /><font color="#bf5b2e">Required</font>        | Indicates if the 3DS ACS method to collect the device details was completed successfully.<br />Values:<br />- Unknown<br />- Yes<br />- No<br />- Unavailable                                                                                                         |


:::

:::ExpandableHeading
### CompleteThreeDSecureTwo Model Parameters

| **Parameter**                                                                        | **Description**                                                                                                                                                                                                                                                       |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cv2`<br />String<br /><font color="#bf5b2e">Required</font><br />                   | The 3 or 4 digit number on the back of a credit card.<br />Also known as the card verification value (CVV) or security code.                                                                                                                                          |
| `primaryAccountDetails`<br />Object<br /><font color="#42cbd4">Optional</font><br /> | For **MCC 6012, 6051&#x20;**&#x61;nd **7299&#x20;**&#x6D;erchants, this object needs to be added to the request. Without this, 3D Secure 2 transactions **will not** be successful.<br /> Values:<br />- name<br />- accountNumber<br />- dateOfBirth<br />- postCode |


:::

Check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

### Payment Receipt

:::ExpandableHeading
### Payment Receipt Model Parameters

| **Parameter**                                            | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `receiptId`<br />String                                  | Judopay's reference for the transaction.<br />Used to process refunds or collections.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `yourPaymentReference`<br />String                       | Your unique reference for this payment. <br />This value should be unique in order to protect your customers against duplicate transactions. <br />With a server side integration, if a payment reference is not supplied, the transaction will not be processed.                                                                                                                                                                                                                                                                                                                                            |
| `type`<br />String                                       | Type of transaction:<br />- Payment<br />- Refund<br />- PreAuth<br />- Collection<br />**This transaction type is available from API Version 6.4.1 onwards**.                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `acquirerTransactionID`<br />String                      | The unique ID of a transaction set by the acquirer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `createdAt`<br />Date                                    | An ISO8601 formatted date and time.<br />Includes time zone offset.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `result`<br />String                                     | Result of transaction.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `message`<br />String                                    | Message detailing the outcome.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `externalBankResponseCode`<br />String                   | Reason code provided by the bank for declined transactions.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `judoId`<br />String                                     | Unique ID supplied by Judopay. <br />Specific to a merchant and/or location.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `merchantName`<br />String                               | Merchant's trading name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `appearsOnStatementAs`<br />String                       | How the Merchant appears on the consumer's statement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `originalAmount`<br />Decimal                            | Amount of transaction.<br />**This field will not be included for Refund and PreAuth transaction types.**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `amountCollected`<br />Decimal                           | Amount collected.<br />**This field will be included for the PreAuth transaction type.**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `netAmount`<br />Decimal                                 | The remaining balance of the transaction after a refund.<br />You cannot refund more than the original transaction amount.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `amount`<br />Decimal                                    | The amount to process.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `currency`<br />String                                   | The currency of the transaction.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `cardDetails`<br />Object                                | Information on the card used in this transaction:<br />- cardLastFour<br />- endDate<br />- cardToken<br />- cardType<br />- startDate<br />- cardScheme<br />- cardFunding<br />- cardCategory<br />- cardCountry<br />- bank                                                                                                                                                                                                                                                                                                                                                                               |
| `consumer`<br />Object                                   | Details of the consumer.<br />Used for repeat transactions.<br />Details:<br />- yourConsumerReference                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `device`<br />Object                                     | Specific device details to identify a consumer:<br />- identifier                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `riskScore`<br />Integer                                 | Consumer's risk score.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `yourPaymentMetaData`<br />String                        | Additional information associated with a transaction to help reconcile.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `threeDSecure`<br />Object                               | For any 3DSecure requests.<br />Includes the result of the authentication process:<br />- attempted<br />- result<br />**This block will not be returned for voids / refunds or collections responses**.                                                                                                                                                                                                                                                                                                                                                                                                     |
| `challengeRequestIndicator`<br />String                  | Indicates the type of challenge request you wish to apply.<br />Values:<br />- `noPreference`<br />- `noChallenge`<br />- No challenge required.<br />- `challengePreferred`<br />- A challenge is preferred for this transaction.<br />- `challengeAsMandate`<br />- Must challenge this transaction.                                                                                                                                                                                                                                                                                                       |
| `scaExemption`<br />String                               | To apply for an exemption from SCA, for a customer initiated transaction.<br />Values:<br />- `lowValue`<br />- Transactions up to €45 do not require SCA, up to a maximum of five consecutive transactions, or a cumulative limit of €100.<br />- `secureCorporate`<br />- Request exemption for payments made using a corporate card.<br />- `trustedBeneficiary`<br />- Provides the cardholder the option to add the merchant to their trusted list.<br />- `transactionRiskAnalysis`<br />- Allows for certain remote transactions to be exempt from SCA, provided a robust risk analysis is performed. |
| `risks`<br />Object                                      | Risk checks on:<br />- postCodeCheck<br />- cv2Check<br />- merchantSuggestion<br />- merchantStatistics                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `recurring`<br />Boolean                                 | Is the transaction a recurring transaction?<br />**If false, the field will not be returned**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `recurringPaymentType`<br />enum<br /><br /><br /><br /> | Type of recurring payment.<br />Values:<br />- RECURRING<br />- Scheduled regular payment.<br />- MIT (Merchant Initiated Transaction)<br />- Unscheduled regular payment.<br />recurringPaymentType is required if `recurringPayment `= **true**.                                                                                                                                                                                                                                                                                                                                                           |


:::

***

## Creating a Refund

You can process a **full&#x20;**&#x6F;r **partial&#x20;**&#x72;efund.

:::hint{type="warning"}
Ensure the **Refund Payments** permission is enabled on your API token.
:::

**Create a refund request**:

:::CodeblockTabs
.NET

```apex
// Create an instance of the Refund model
var refundRequest = new RefundModel()
{
    ReceiptId = yourPaymentReceiptId,
    Amount = 1.01m // Optional, if not specified full payment amount will be refunded
};

//Send the request to Judopay
var response = await client.Refunds.Create(refundRequest);

if (response.HasError)
{
    if (response.Error.Code == (int)HttpStatusCode.Forbidden)
    {
        // Failed to authenticate - check your credentials
    }
    else if (response.Error.ModelErrors != null)
    {
        // Validation failed on the request, check each list entry for details
    }
    else
    {
        // Refer to https://docs.judopay.com/Content/Developer%20Tools/Codes.htm#Errors
        var errorCode = response.Error.Code;
    }
}
else if (response.Response is PaymentReceiptModel receipt)
{
    var receiptId = receipt.ReceiptId;
    var status = receipt.Result;
}
```
:::

| **Parameter**                                                                            | **Description**                                                                                                                                                                                                            |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `receiptId`<br />String<br /><font color="#ef5b2e">Required</font>                       | Judopay's reference for the transaction that is to be refunded.                                                                                                                                                            |
| `amount`<br />Decimal<br /><font color="#ef5b2e">Required</font>                         | The amount to refund.<br />Format:<br />- Two decimal places<br />For currencies using a different structure please contact Judopay for support.                                                                           |
| `currency`<br />String<br /><font color="#ef5b2e">Required</font>                        | If specified, the currency must match the original transaction.<br />If not specified, the currency of the original transaction will be used.<br />Any ISO 4217 alphabetic currency code:<br />- GBP<br />- USD<br />- EUR |
| `yourPaymentReference`<br />String&#xD;<br />&#xD;<font color="#ef5b2e">Required</font> | Your unique reference for this refund.<br />Format:<br />- Maximum length 50 characters.<br />**This is not the yourPaymentReference of the original transaction**.                                                        |

Check the [Payment Receipt Model](docId\:hNgLLJxESInHS7PtfEvTN) response.&#x20;

***

## Going Live

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

:::hint{type="warning"}
You will need to have tested your app in the sandbox environment before going live.
:::

:::::WorkflowBlock
:::WorkflowBlockItem
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.&#x20;

We will contact you as soon as you are live.
:::

::::WorkflowBlockItem
Point to the Live Environment.

- Replace your sandbox API Token and Secret for the live API Token and Secret&#x20;
  - Find these in **Judopay Portal** > **Your apps** > \{**app name**} >**&#x20;Live Tokens**

:::CodeblockTabs
.NET

```apex
//In the:
JudoPaymentsFactory.Create

//method, change the environment from Sandbox to Live:
var client = JudoPaymentsFactory.Create(JudoEnvironment.Live, "YOUR_API_TOKEN", "YOUR_API_SECRET");

```
:::
::::

:::WorkflowBlockItem
Test Live Payments.

- Ensure the SDK is properly configured for the **live&#x20;**&#x65;nvironment.
- 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.&#x20;
  - Send a refund through the **Judopay Portal** > **History.**
- Test all payment scenarios and security features to verify the expected behaviour.
:::
:::::

