Execute Function Code (Simulation)

POST {{host}}/za/v1/cards/:cardkey/code/execute

Publish specified code to the specific card. Note: This allows you to push code to the specified card. After successfully publishing the code it will execute the next time a card transaction occurs.

Request Body

{"simulationcode"=>"// This function runs during the card transaction authorization flow.\n// It has a limited execution time, so keep any code short-running.\nconst beforeTransaction = async (authorization) => {\n    console.log(authorization);\n    return true;\n};\n\n// This function runs after a transaction.\nconst afterTransaction = async (transaction) => {\n    console.log(transaction)\n};\n\n// This function runs after a transaction.\nconst afterDecline = async (transaction) => {\n    console.log(transaction)\n};", "centsAmount"=>"10100", "currencyCode"=>"zar", "merchantCode"=>7996, "merchantName"=>"USkaka", "merchantCity"=>"Durban", "countryCode"=>"ZA"}

HEADERS

KeyDatatypeRequiredDescription
Acceptstring
Content-Typestring