Visual FoxPro
Visual FoxPro
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 Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loHttp
LOCAL loJson
LOCAL loResp
LOCAL loSbResponseBody
LOCAL loJResp
LOCAL lnRespStatusCode
LOCAL lcPspReference
LOCAL lcResultCode
LOCAL lcMerchantReference
LOCAL lcPaymentMethod
LOCAL lcShopperLocale
lnSuccess = 0
loHttp = CreateObject('Chilkat.Http')
* 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..."
* }
loJson = CreateObject('Chilkat.JsonObject')
loJson.UpdateString("payload","2he28Ddhwj242he28Ddhwj...")
loHttp.SetRequestHeader("X-API-Key","Your_API_key")
loResp = CreateObject('Chilkat.HttpResponse')
lnSuccess = loHttp.HttpJson("POST","https://checkout-test.adyen.com/v41/payments/result",loJson,"application/json",loResp)
IF (lnSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loJson
RELEASE loResp
CANCEL
ENDIF
loSbResponseBody = CreateObject('Chilkat.StringBuilder')
loResp.GetBodySb(loSbResponseBody)
loJResp = CreateObject('Chilkat.JsonObject')
loJResp.LoadSb(loSbResponseBody)
loJResp.EmitCompact = 0
lnRespStatusCode = loResp.StatusCode
? "Status Code = " + STR(lnRespStatusCode)
? "Response Body:"
? loJResp.Emit()
IF (lnRespStatusCode >= 400) THEN
? "Response Header:"
? loResp.Header
? "Failed."
RELEASE loHttp
RELEASE loJson
RELEASE loResp
RELEASE loSbResponseBody
RELEASE loJResp
CANCEL
ENDIF
* 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
lcPspReference = loJResp.StringOf("pspReference")
lcResultCode = loJResp.StringOf("resultCode")
lcMerchantReference = loJResp.StringOf("merchantReference")
lcPaymentMethod = loJResp.StringOf("paymentMethod")
lcShopperLocale = loJResp.StringOf("shopperLocale")
RELEASE loHttp
RELEASE loJson
RELEASE loResp
RELEASE loSbResponseBody
RELEASE loJResp