I am trying to follow the documentation to generate a p12 key for Simple Order in this document: https://developer.cybersource.com/library/documentation/dev_guides/security_keys/creating_and_using_security_keys.pdf
However, the documentation seems out of date with what cybersource admin UI does. I do get a p12 key, which I have added to my local keystore (macos). However communications seem to fail when using this key with:
There was an unexpected error (type=Internal Server Error, status=500).
io.sphere.sdk.client.BadGatewayException: detailMessage: {"statusCode":502,"message":"The extension returned update actions that could not be executed.","errors":[{"code":"ExtensionUpdateActionsFailed","message":"The extension returned update actions that could not be executed.","extensionErrors":[{"code":"InvalidOperation","message":"Field definition for 'reason' does not exist on type 'isv_payment_failure'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension"},{"code":"RequiredField","message":"A value is required for field 'reasonCode'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension","field":"reasonCode"},{"code":"RequiredField","message":"A value is required for field 'transactionId'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension","field":"transactionId"}]}]} summary: POST https://api.europe-west1.gcp.commercetools.com/cys/me/payments/8dd08a81-df1f-42f8-9bce-eca95fbf9b98 failed with response code 502 on 2020-11-25T12:49:09.730464Z http response formatted body: { "statusCode" : 502, "message" : "The extension returned update actions that could not be executed.", "errors" : [ { "code" : "ExtensionUpdateActionsFailed", "message" : "The extension returned update actions that could not be executed.", "extensionErrors" : [ { "code" : "InvalidOperation", "message" : "Field definition for 'reason' does not exist on type 'isv_payment_failure'.", "action" : { "action" : "addInterfaceInteraction", "type" : { "typeId" : "type", "key" : "isv_payment_failure" }, "fields" : { "reason" : "com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'" } }, "extensionId" : "3275732b-0798-45f7-a1c9-af03102309dc", "extensionKey" : "isv_payment_update_extension" }, { "code" : "RequiredField", "message" : "A value is required for field 'reasonCode'.", "action" : { "action" : "addInterfaceInteraction", "type" : { "typeId" : "type", "key" : "isv_payment_failure" }, "fields" : { "reason" : "com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'" } }, "extensionId" : "3275732b-0798-45f7-a1c9-af03102309dc", "extensionKey" : "isv_payment_update_extension", "field" : "reasonCode" }, { "code" : "RequiredField", "message" : "A value is required for field 'transactionId'.", "action" : { "action" : "addInterfaceInteraction", "type" : { "typeId" : "type", "key" : "isv_payment_failure" }, "fields" : { "reason" : "com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'" } }, "extensionId" : "3275732b-0798-45f7-a1c9-af03102309dc", "extensionKey" : "isv_payment_update_extension", "field" : "transactionId" } ] } ] } http response: io.sphere.sdk.http.HttpResponseImpl@4d23eda6[statusCode=502,headers={date=[Wed, 25 Nov 2020 12:49:09 GMT], content-length=[1588], server=[istio-envoy], x-envoy-upstream-service-time=[896], Alt-Svc=[clear], access-control-allow-headers=[Accept, Authorization, Content-Type, Origin, User-Agent, X-Correlation-ID], x-correlation-id=[cys/42d52d8f-4f20-4965-b645-c80fcf384b3b], x-http-status-caused-by-extension=[true], access-control-allow-methods=[GET, POST, DELETE, OPTIONS], Via=[1.1 google], access-control-allow-origin=[*], access-control-max-age=[299], content-type=[application/json; charset=utf-8], server-timing=[projects;dur=895]},associatedRequest=<null>,textInterpretedBody={"statusCode":502,"message":"The extension returned update actions that could not be executed.","errors":[{"code":"ExtensionUpdateActionsFailed","message":"The extension returned update actions that could not be executed.","extensionErrors":[{"code":"InvalidOperation","message":"Field definition for 'reason' does not exist on type 'isv_payment_failure'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension"},{"code":"RequiredField","message":"A value is required for field 'reasonCode'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension","field":"reasonCode"},{"code":"RequiredField","message":"A value is required for field 'transactionId'.","action":{"action":"addInterfaceInteraction","type":{"typeId":"type","key":"isv_payment_failure"},"fields":{"reason":"com.cybersource.ws.client.ClientException: Exception while obtaining private key from KeyStore with alias, 'test_ct_02'"}},"extensionId":"3275732b-0798-45f7-a1c9-af03102309dc","extensionKey":"isv_payment_update_extension","field":"transactionId"}]}]}] SDK: 1.44.0 project: cys endpoint: POST /me/payments/8dd08a81-df1f-42f8-9bce-eca95fbf9b98 Java: 11.0.9.1 cwd: /Users/yoann.esnaud/workspace/cymbal/simulator sphere request: isv.commercetools.simulator.sphere.sdk.commands.payment.MyPaymentUpdateCommand@513b57f3 http request: HttpRequestImpl[httpMethod=POST,url=https://api.europe-west1.gcp.commercetools.com/cys/me/payments/8dd08a81-df1f-42f8-9bce-eca95fbf9b98,headers={Authorization=[**removed from output**], User-Agent=[commercetools-jvm-sdk/1.44.0 (AHC/2.1) Java/11.0.9.1+1 (Mac OS X; x86_64)], Accept-Encoding=[gzip], X-Correlation-ID=[cys/42d52d8f-4f20-4965-b645-c80fcf384b3b]},body=io.sphere.sdk.http.StringHttpRequestBody@5f7b5b49[body={"version":2,"actions":[{"action":"addTransaction","transaction":{"amount":{"type":"centPrecision","centAmount":549,"currencyCode":"GBP"},"state":"Initial","type":"Authorization"}}]}]] http request formatted body: { "version" : 2, "actions" : [ { "action" : "addTransaction", "transaction" : { "amount" : { "type" : "centPrecision", "centAmount" : 549, "currencyCode" : "GBP" }, "state" : "Initial", "type" : "Authorization" } } ] } additional notes: [] Javadoc: http://commercetools.github.io/commercetools-jvm-sdk/apidocs/io/sphere/sdk/client/BadGatewayException.html}
Can anyone help with how to generate and use the p12 key?
Thanks.
I followed these steps create a P12 Certificate to generate the .p12 key.
However, to use it (in ASP.NET), using the Simple Order API...
Create a folder within your project named "CyberSourceKeys" and add the [merchantid].p12 key to it.
Create the configuration object, ensure you set the "KeysDirectory" property:
Create the request object:
Call the API, passing in both variables:
I used the documentation found here (search for "keysdirectory"): Simple Order API Development Guide