Skip to content

Commit

Permalink
Update README.md (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-zijdemans-vipps authored Nov 13, 2023
1 parent 8a87a50 commit 4e4ac15
Showing 1 changed file with 2 additions and 102 deletions.
104 changes: 2 additions & 102 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,102 +1,2 @@
---
sidebar_label: .NET
pagination_next: null
pagination_prev: null
---

# .NET SDK

The official .NET SDK for the Checkout and ePayment APIs. Supports .NET Standard 2.0+, .NET Core 2.0+ and .NET Framework 4.8+.

You can install the SDK with Nuget as per [Installation](#installation).
More information about the package can be found on [nuget.org](https://www.nuget.org/packages/Vipps.net).


**Features**

- Serialization/deserialization
- Authentication
- Network retries
- Idempotency

## Installation

.NET Core CLI:

```sh
dotnet add package vipps.net
```

## Usage

```C#
var vippsConfigurationOptions = new VippsConfigurationOptions
{
ClientId = "CLIENT-ID",
ClientSecret = "CLIENT-SECRET",
MerchantSerialNumber = "MERCHANT-SERIAL-NUMBER",
SubscriptionKey = "SUBSCRIPTION-KEY",
UseTestMode = true
};

var vippsApi = new VippsApi(vippsConfigurationOptions)

var request = new InitiateSessionRequest
{
MerchantInfo = new PaymentMerchantInfo
{
CallbackAuthorizationToken = Guid.NewGuid().ToString(),
CallbackUrl = "https://your-url-here.com:3000",
ReturnUrl = "https://your-url-here.com:3000",
},
Transaction = new PaymentTransaction
{
Amount = new Amount { Currency = "NOK", Value = 10000 },
PaymentDescription = "test",
Reference = Guid.NewGuid().ToString()
}
};

var result = await vippsApi.CheckoutService.InitiateSession(request);

```

### Unimplemented parameters and properties

This SDK offers typed request and response classes. These classes might not be up-to-date if you are on the bleeding edge of our APIs, or if you use features that are not generally available.

#### Request

All request objects have a property called `AdditionalProperties`. This is a dictionary that if set will merge with the request object.

**`AdditionalProperties` example:**

```c#
InitiateSessionRequest initiateSessionRequest = new()
{
Transaction = new PaymentTransaction()
{
Amount = new Amount()
{
Currency = "NOK",
Value = 49000
},
PaymentDescription = "Hei"
},
AdditionalProperties =
{
{ "Configuration", new { AcceptedPaymentMethods = new[] { "WALLET", "CARD" } } }
}
};
```

#### Response

All response objects have a property called `RawResponse` that contains the response in the form of a Json Object.

**`RawResponse` example:**

```c#
var response = vippsApi.CheckoutService.InitiateSession(initiateSessionRequest);
var cancellationUrl = response.RawResponse["cancellationUrl"].ToString();
```
ℹ️ Documentation is available at:
[Vipps MobilePay Technical Documentation](https://developer.vippsmobilepay.com/docs/SDKs/dotnet-sdk).

0 comments on commit 4e4ac15

Please sign in to comment.