Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Adyen Create Payment SessionCreates an Adyen payment session.
integer li_rc oleobject loo_Http integer li_Success oleobject loo_Json oleobject loo_Resp oleobject loo_SbResponseBody oleobject loo_JResp integer li_RespStatusCode string ls_PaymentSession loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") if li_rc < 0 then destroy loo_Http MessageBox("Error","Connecting to COM object failed") return end if // Use this online tool to generate the code from sample JSON: // Generate Code to Create JSON // The following JSON is sent in the request body, and is constructed by the code that follows. // { // "merchantAccount": "YourMerchantAccount", // "sdkVersion": "1.9.7", // "channel": "Web", // "amount": { // "currency": "EUR", // "value": 17408 // }, // "reference": "Your order number", // "countryCode": "NL", // "shopperLocale": "nl_NL", // "origin": "https://www.yourshop.com", // "returnUrl": "https://www.yourshop.com/checkout/completed" // } loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("merchantAccount","YourMerchantAccount") loo_Json.UpdateString("sdkVersion","1.9.7") loo_Json.UpdateString("channel","Web") loo_Json.UpdateString("amount.currency","EUR") loo_Json.UpdateInt("amount.value",17408) loo_Json.UpdateString("reference","Your order number") loo_Json.UpdateString("countryCode","NL") loo_Json.UpdateString("shopperLocale","nl_NL") loo_Json.UpdateString("origin","https://www.yourshop.com") loo_Json.UpdateString("returnUrl","https://www.yourshop.com/checkout/completed") loo_Http.SetRequestHeader("X-API-Key","YourAPIkey") loo_Resp = loo_Http.PostJson3("https://checkout-test.adyen.com/v41/paymentSession","application/json",loo_Json) if loo_Http.LastMethodSuccess = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Http destroy loo_Json return end if loo_SbResponseBody = create oleobject // Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0 li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder") loo_Resp.GetBodySb(loo_SbResponseBody) loo_JResp = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject") loo_JResp.LoadSb(loo_SbResponseBody) loo_JResp.EmitCompact = 0 li_RespStatusCode = loo_Resp.StatusCode Write-Debug "Status Code = " + string(li_RespStatusCode) Write-Debug "Response Body:" Write-Debug loo_JResp.Emit() if li_RespStatusCode >= 400 then Write-Debug "Response Header:" Write-Debug loo_Resp.Header Write-Debug "Failed." destroy loo_Resp destroy loo_Http destroy loo_Json destroy loo_SbResponseBody destroy loo_JResp return end if destroy loo_Resp // Sample JSON response: // { // "paymentSession": "eyJjaGVja291 ... iMS45LjcifQ==" // } // Sample code for parsing the JSON response... // Use the following online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON ls_PaymentSession = loo_JResp.StringOf("paymentSession") destroy loo_Http destroy loo_Json destroy loo_SbResponseBody destroy loo_JResp |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.