MoMoSdk 3.0.0

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package MoMoSdk --version 3.0.0
                    
NuGet\Install-Package MoMoSdk -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MoMoSdk" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MoMoSdk" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MoMoSdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MoMoSdk --version 3.0.0
                    
#r "nuget: MoMoSdk, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MoMoSdk@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MoMoSdk&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MoMoSdk&version=3.0.0
                    
Install as a Cake Tool

Welcome to MoMoSdk!

MoMoSdk is a library for interact with MoMo . wallet APIs

Setting

following appsettings.json file:

{   
      "MoMoPayment": {  
    	  "Endpoint": "https://test-payment.momo.vn/v2/gateway/api",  
    	  "AccessKey": "mTCKt9W3eU1m39TW",  
    	  "SecretKey": "SetA5RDnLHvt51AULf51DyauxUo3kDU6",  
    	  "PartnerCode": "MOMOLRJZ20181206",  
    	  "PartnerName": "PRUgift",  
    	  "StoreId": "",  
    	  "RedirectUrl": "https://localhost:7244/Redirect",  
    	  "IpnUrl": "https://3525-14-231-221-55.ap.ngrok.io/api/InstantPaymentNotification"  
      }  
}

Endpoint: MoMo's API AccessKey: your AccessKey SecretKey: your SecretKey PartnerCode: your PartnerCode PartnerName: your PartnerName StoreId: your StoreId RedirectUrl: A partner's URL. This URL is used to redirect from MoMo page to partner's page after customer's payment. IpnUrl: Partner API. Used by MoMo to submit payment results by method (server-to-server) method

Config

add Setting into Program.cs

builder.Services.AddMoMoSdk();

Create Order

add MoMo service

private readonly IMoMoService _momoService;

crete model:

public class CreateOrderViewModel  
{  
    public MoMoRequestType RequestType { get; set; }  
    public string OrderId { get; set; }  
    public string OrderInfo { get; set; }  
    public long Amount { get; set; }  
      
    public DeliveryInfo DeliveryInfo { get; set; }  
      
    public UserInfo UserInfo { get; set; }  
}

create order

PaymentResponse paymentResponse = await _momoService.CreatePayment( model.RequestType,model.OrderId,model.Amount,model.OrderInfo,MoMoCodeHelper.Base64Encode("{}"),new List<Item>(),model.DeliveryInfo,model.UserInfo);

Query Order

QueryResponse queryResponse = await _momoService.QueryPayment(orderId);

Handle Redirect

public void Index([FromQuery] RedirectQuery query)  
{  
    if (_momoService.CheckRedirectUrl(query))  
    {  
        //do somethings here
   }  
  
   throw new Exception("Wrong Signature from MoMo Server");  
}

Handle Instant Payment Notification

[HttpPost]  
public StatusCodeResult Post([FromBody] IPNModel model)  
{  
    if (_momoService.CheckIPN(model))  
    {  
        //do somethings here
  }  
    return BadRequest();  
}

Create Refund

Refund Model

public class RefundViewModel  
{  
    public string OrderId { get; set; }  
    public long Amount { get; set; }  
    public long TransId { get; set; }  
    public string? Description { get; set; }  
}

create request refund

RefundResponse paymentResponse = await _momoService.CreateRefund(model.OrderId,model.Amount,model.TransId,model.Description);

Query Refund

QueryRefundResponse  queryRefundResponse = await _momoService.QueryRefund(orderId);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated