NICEPAY API
...
API E-Wallet (Direct Debit) SN...
Refund Transaction - API E-Wallet (Direct Debit) SNAP
11 min
about refund transaction api e wallet (direct debit) snap this api uses to request the refund process from a transaction on the e wallet payment method with direct debit host to host feature based on the snap bi standard refund transaction api e wallet (direct debit) snap please request the access token firsthand before performing the authentication through the docid 92feymrqs iebhxrfgxuq section 180,555,117 unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type request header parameter for refund transaction api e wallet (direct debit) snap 167,68,77,101,306 true unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type request body parameter for refund transaction api e wallet (direct debit) snap 238,95,89,100,167 true 3 unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type center unhandled content type unhandled content type response parameter for refund transaction api e wallet (direct debit) snap 231,65,82,103,167 true unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type unhandled content type unhandled content type center unhandled content type center unhandled content type unhandled content type sample parameter for refund transaction api e wallet (direct debit) snap request parameter curl curl x post \\ 'https //dev nicepay co id/nicepay/api/v1 0/debit/refund' \\ h 'content type application/json' \\ h 'authorization bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=' \\ h 'x timestamp 2024 12 31t10 11 40+07 00' \\ h 'x signature ufbw7r8rhw79ioiv/hlv607m60qzaybv8uzmbsryb6/thlo/fhqvp4xryeluehoss9o+qs6vwtkb/ygtucc+tq==' \\ h 'x partner id tniceew051' \\ h 'x external id txid202402111402271707638101' \\ h 'channel id tniceew05101' \\ d '{"merchantid" "00007100010926","submerchantid" "310928924949487","originalpartnerreferenceno" "2020102900000000000001","originalreferenceno" "tniceew05105202210141451109841","partnerrefundno" "239850918204981205970","refundamount" {"value" "10000 00","currency" "idr"},"externalstoreid" "124928924949487","reason" "customer complain","additionalinfo" {"refundtype" "1"}}' node js const config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid "tniceew051", iscloudserver false, }; let parameterrefund = { body { merchantid "00007100010926", submerchantid "310928924949487", originalpartnerreferenceno "2020102900000000000001", originalreferenceno "tniceew05105202210141451109841", partnerrefundno "239850918204981205970", refundamount { value "10000 00", currency "idr", }, externalstoreid "124928924949487", reason "customer complain", additionalinfo { refundtype "1", }, }, headers { x timestamp "2024 12 31t10 11 40+07 00", x partner id "tniceew051", x external id "txid202402111402271707638101", channel id "tniceew05101", }, }; let endpoint = `/api/v1 0/debit/refund`; // refund endpoint let snap = new snap(config); let response = snap requestsnaptransaction( parameterrefund, endpoint, "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=", // access token "post" );string accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; // step 1 initialize the nicepay configuration config = nicepay builder() isproduction(false) clientsecret("your client secret") partnerid("tniceew051") externalid("txid202402111402271707638101") timestamp("2024 12 31t10 11 40+07 00") privatekey("your private key") build(); // step 2 define the debit refund request body cancel requestdata = cancel builder() merchantid("00007100010926") submerchantid("310928924949487") originalpartnerreferenceno("2020102900000000000001") originalreferenceno("tniceew05105202210141451109841") partnerrefundno("239850918204981205970") refundamount("10000 00", "idr") externalstoreid("124928924949487") reason("customer complain") refundtype("1") build(); // step 3 execute the refund nicepayresponse result = snapcancelservice callserviceewalletcancel(requestdata, accesstoken, config);bodycreatetoken = ( builderaccesstoken buildaccesstoken() setgranttype("client credentials") setadditionalinfo({}) build() ) bodydirectdebitrefund = ( builderdirectdebit builddirectdebitrefund() setpartnerrefundno("239850918204981205970") setmerchantid("tniceew051") setsubmerchantid("310928924949487") setoriginalpartnerreferenceno("2020102900000000000001") setoriginalreferenceno("tniceew05105202210141451109841") setexternalstoreid("124928924949487") setreason("customer complain") setrefundamount({ "value" "10000 00", "currency" "idr" }) setadditionalinfo({ "refundtype" "1" }) build() ) environment = (builderenvironment buildenvironment() iscloud(false) isproduction(false) build()) result = snapservice servicetransaction(bodycreatetoken jsonaccesstoken(), bodydirectdebitrefund jsondirectdebitrefund(), constantsendpoints refunddirectdebit(), environment) c# testingconstant config = new testingconstant(); string privatekey = config privatekey; string clientsecret = config clientsecret; // variables used multiple times for configuration/header generation const string client id = "tniceew051"; const string channel id = "tniceew05101"; const string x timestamp = "2024 12 31t10 11 40+07 00"; const string access token = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; string clientid = client id; string timestamp = x timestamp; string channelid = channel id; bool isproduction = false; bool iscloudserver = false; if (string isnullorempty(clientid) || string isnullorempty(clientsecret)) { console writeline("clientid or clientsecret cannot be empty "); assert fail("clientid or clientsecret cannot be empty "); return; } // generate signature string signature = signaturegeneratorutils generatesignature(privatekey, clientid, timestamp); // get access token (b2b flow) var tokenrequester = new accesstokenrequester(); string accesstokenresponse = await tokenrequester getaccesstokenasync(clientid, signature, timestamp, isproduction, iscloudserver); dynamic accesstokenobject = jobject parse(accesstokenresponse); string accesstoken = access token; // using hardcoded token // create ewallet service apiendpoints apiendpoints = new apiendpoints(); apiservice ewalletservice = new apiservice(apiendpoints, clientsecret, clientid, channelid, isproduction, iscloudserver); snapewalletservices snapewalletservices = new snapewalletservices(clientid); string createrequestbody = snapewalletservices generaterefundewalletrequest( merchantid "00007100010926", submerchantid "310928924949487", originalpartnerreferenceno "2020102900000000000001", originalreferenceno "tniceew05105202210141451109841", partnerrefundno "239850918204981205970", externalstoreid "124928924949487", refundamountvalue "10000 00", currency "idr", reason "customer complain", refundtype "1" ); console writeline("refund ewallet request " + createrequestbody); string createresponse = await ewalletservice sendpostrequest( apiendpoints refundewallet, accesstoken, timestamp, createrequestbody, "txid202402111402271707638101" ); console writeline("refund ewallet response " + createresponse); laravel string access token = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; string x timestamp = "2024 12 31t10 11 40+07 00"; string x external id = "txid202402111402271707638101"; string channel id = "tniceew05101"; protected $useprod = false; protected $usecloud = false; protected $refund ewallet endpoint = "/api/v1 0/debit/refund"; // credential protected $client id = "tniceew051"; protected $key = " private key merchant"; protected $client secret = " client secret merchant"; protected $access token = access token; protected $store id = "124928924949487"; $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >refund ewallet endpoint; $helper = new helpers(); $http method = "post"; $x time stamp = x timestamp; $partner id = $this >client id; $client secret = $this >client secret; $access token = $this >access token; $store id = $this >store id; $external id = x external id; $partner refund no = "239850918204981205970"; $refundamount = \[ "value" => "10000 00", "currency" => "idr" ]; $additionalinfo = \[ "refundtype" => "1" ]; $body = \[ "merchantid" => "00007100010926", "submerchantid" => "310928924949487", "originalreferenceno" => "tniceew05105202210141451109841", "originalpartnerreferenceno" => "2020102900000000000001", "partnerrefundno" => $partner refund no, "refundamount" => $refundamount, "externalstoreid" => $store id, "reason" => "customer complain", "additionalinfo" => $additionalinfo ]; $string to sign = $helper >generatestringtosign( $http method, $this >refund ewallet endpoint, $access token, $body, $x time stamp ); $signature = $helper >hmacsha512encoded( $string to sign, $client secret, openssl algo sha512 ); $header = $helper >generateheader( $access token, $x time stamp, $signature, $partner id, $external id, channel id ); try { $response = httputil postjsonrequestwithheader($url, $body, $header); } catch (exception $e) { // handle exception } php native $config = nicepay builder() >setisproduction(false) >setclientsecret(testconst $client secret) >setpartnerid("tniceew051") >setexternalid("txid202402111402271707638101") >settimestamp("2024 12 31t10 11 40+07 00") >setprivatekey(testconst $private key) >build(); $requestbody = cancel builder() >setmerchantid("00007100010926") >setsubmerchantid("310928924949487") >setoriginalpartnerreferenceno("2020102900000000000001") >setoriginalreferenceno("tniceew05105202210141451109841") >setpartnerrefundno("239850918204981205970") >setrefundamount("10000 00", "idr") >setexternalstoreid("124928924949487") >setreason("customer complain") >setrefundtype("1") >build(); $accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; $snapewalletservice = new snapewalletservice($config); try { $response = $snapewalletservice >refund($requestbody, $accesstoken); } catch (\exception $e) { // handle exception }const val access token = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" // step 1 initialize the nicepay configuration var config nicepay = nicepay builder() isproduction(false) clientsecret("your client secret") partnerid("tniceew051") externalid("txid202402111402271707638101") timestamp("2024 12 31t10 11 40+07 00") privatekey("your private key") build() // step 2 define the static debit refund request body val refundewallet snapcancel = snapcancel builder() merchantid("00007100010926") submerchantid("310928924949487") originalpartnerreferenceno("2020102900000000000001") originalreferenceno("tniceew05105202210141451109841") partnerrefundno("239850918204981205970") externalstoreid("124928924949487") refundamount("10000 00", "idr") refundtype("1") reason("customer complain") build() // step 3 execute the refund val response nicepayresponse? = snapewalletservice refund(refundewallet, access token, config) codeigniter $config = nicepay builder() >setisproduction(false) >setiscloudserver(iscloudserver true) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid("tniceew051") >setexternalid("txid202402111402271707638101") >settimestamp("2024 12 31t10 11 40+07 00") >build(); $accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8="; $requestbody = refundewallet builder() >setmerchantid("00007100010926") >setsubmerchantid("310928924949487") >setoriginalpartnerreferenceno("2020102900000000000001") >setoriginalreferenceno("tniceew05105202210141451109841") >setpartnerrefundno("239850918204981205970") >setrefundamount("10000 00", "idr") >setexternalstoreid("124928924949487") >setreason("customer complain") >setadditionalinfo(\["refundtype" => "1"]) >build(); $snapewalletservice = new snapewalletservice(); try { $response = $snapewalletservice >refundewallet($requestbody, $accesstoken, $config); } catch (\exception $e) { // handle exception } response parameter sample response { "responsecode" "2005800", "responsemessage" "successful", "originalpartnerreferenceno" "2020102900000000000001", "originalreferenceno" "tniceew05105202210141451109841", "refundno" "ref993883", "partnerrefundno" "239850918204981205970", "refundamount" { "value" "10000 00", "currency" "idr" }, "refundtime" "2020 12 21t17 21 41+07 00", "additionalinfo" { "refundtype" "1" } }