C# SDK¶
C# SDK allows you to accept payment with Visa/MasterCard cards on your website.
Lates version of C# SDK you can always find in our public repository:
https://github.com/cloudipsp/csharp-sdk
Step by step implementation case¶
You will find all code examples by link
-
create order and obtain payment token:
for this step you need
class Token
if you are planing to use recurring payments in future, add parameter
recurring = 'y'
in request:Config.ContentType = "json"; int amount = Convert.ToInt32(Request.Form["amount"].Substring(0, Request.Form["amount"].IndexOf('.') > 0 ? Request.Form["amount"].IndexOf('.') : Request.Form["amount"].Length)); var req = new TokenRequest { order_id = Request.Form["order_id"], recurring = "y", amount = amount * 100, order_desc = "Order description", currency = "GEL" }; DoRequest(req);
in response you will receive payment token in parameter
resp.token
:private void DoRequest(TokenRequest req) { var resp = new Token().Post(req); if (resp.Error != null) { DataError = resp.Error.ErrorMessage; Data = resp.Error.RequestId; } else { DataUri = resp.token; } }
-
send payment token from
resp.token
to frontend.You can choose 2 solutions for web payment form implementation on frontend: Embedded iframe or JavaScript native form both for cards and Apple/Google Pay
For JavaScript native frontend form pass payment token to JavaScript payment form in dictionary
{ "payment_system":"card", "token": `resp.token`, "card_number":"16/19-digits number", "expiry_date":"Supported formats: MM/YY, MM/YYYY, MMYY, MMYYYY", "cvv2":"3-digits number" }
For Embedded IFrame form pass payment token to payment form in
Options
object (see example)var Options = { options: { methods: ['card'], methods_disabled: [], card_icons: ['mastercard', 'visa', 'maestro'], active_tab: 'card', fields: false, title: 'Demo checkout', link: 'https://shop.com', full_screen: true, button: true, email: true }, params: { token: `resp.token` } } checkout("#checkout-container", Options);
Solution for mobile application you can choose depending on programming language framework you application is developed: