PowerBuilder
PowerBuilder
Adyen Verify Payment Result
See more Adyen Examples
Once a payment has completed, this verifies the result from your server with a /payments/result request.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Http
oleobject loo_Json
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_PspReference
string ls_ResultCode
string ls_MerchantReference
string ls_PaymentMethod
string ls_ShopperLocale
li_Success = 0
loo_Http = create oleobject
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.
// {
// "payload": "2he28Ddhwj242he28Ddhwj..."
// }
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject")
loo_Json.UpdateString("payload","2he28Ddhwj242he28Ddhwj...")
loo_Http.SetRequestHeader("X-API-Key","Your_API_key")
loo_Resp = create oleobject
li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse")
li_Success = loo_Http.HttpJson("POST","https://checkout-test.adyen.com/v41/payments/result",loo_Json,"application/json",loo_Resp)
if li_Success = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Json
destroy loo_Resp
return
end if
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
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_Http
destroy loo_Json
destroy loo_Resp
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
// Sample JSON response:
// {
// "pspReference": "851559480052382F",
// "resultCode": "Authorised",
// "merchantReference": "123",
// "paymentMethod": "ideal",
// "shopperLocale": "nl_NL"
// }
// 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_PspReference = loo_JResp.StringOf("pspReference")
ls_ResultCode = loo_JResp.StringOf("resultCode")
ls_MerchantReference = loo_JResp.StringOf("merchantReference")
ls_PaymentMethod = loo_JResp.StringOf("paymentMethod")
ls_ShopperLocale = loo_JResp.StringOf("shopperLocale")
destroy loo_Http
destroy loo_Json
destroy loo_Resp
destroy loo_SbResponseBody
destroy loo_JResp