NICEPAY API
...
API Virtual Account SNAP
Registration - API Virtual Account SNAP
12 min
tentang registration api virtual account snap api dengan standar snap ini digunakan untuk mengajukan pendaftaran sebelum melakukan pembayaran menggunakan metode pembayaran virtual account jika anda ingin melihat penjelasan umum metode pembayaran virtual account, anda dapat mengunjungi docid\ bsnuzmhnlj9h0wrndsqyj untuk pengaturan integrasi fitur nicepay inquiry virtual account, anda dapat mengunjungi halaman docid\ w zwlzxm p6fyqa3tqadd spesifikasi panjang nomor virtual account seperti yang sudah jelaskan pada halaman docid 9tv3ro3 lj1f guz2gark , panjang dari nomor va yang dapat dibuat berbeda beda pada setiap bank panjang nomor va dapat ditentukan sendiri sesuai dengan kebutuhan bisnis selama nomor va tersebut tidak melebihi kapasitas panjang maksimum yang sudah termasuk dengan angka prefix bank dan prefix nicepay berikut adalah tabel persyaratan panjang nomor va untuk beberapa bank true 166 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 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 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 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 catatan nicepay+bank prefix length merupakan persyaratan panjang angka untuk nomor prefix nicepay dan bank contoh kasus apabila anda sebagai merchant ingin melakukan integrasi dengan va bank mandiri, maka anda wajib untuk memberikan ruang sebesar 8 digit untuk prefix va yang terdiri dari prefix bank dan prefix nicepay selanjutnya, angka setelah prefix akan terbagi menjadi 2 tipe sesuai dengan tipe va yang ingin buat fixed va anda dapat melakukan kustomisasi angka setelah angka prefix va yang nicepay sebut sebagai customer id atau merfixacctid dengan catatan bahwa angka tersebut tidak lebih dari 19 digit panjang maksimal untuk nomor va dari bank mandiri normal va anda tidak dapat melakukan kustomisasi angka setelah angka prefix va karena angka tersebut akan melalui proses generate secara otomatis dan acak oleh sistem dengan catatan bahwa angka tersebut tidak lebih dari 19 digit panjang maksimal untuk nomor va dari bank mandiri panjang nomor va secara default adalah 16 digit kecuali ada skema khusus dari bank, nicepay, dan merchant meskipun setiap bank dapat memiliki panjang nomor va yang berbeda, merchant disarankan untuk dapat mengakomodasi panjang nomor va dalam satu deret maksimum 30 digit registration api virtual account snap silakan mengajukan akses token terlebih dahulu untuk melakukan autentikasi melalui bagian docid\ gcgqbiyxg1etcd0ji9chx 181,562,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 registration header parameter 144,77,85,105,253 true unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type unhandled content type left unhandled content type left unhandled content type unhandled content type unhandled content type unhandled content type request registration body parameter untuk parameter partnerserviceid dan virtualaccountno dapat dikirim dengan nilai kosong 184,75,76,105,181 true 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 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 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 response registration parameter true 177,81 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 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 sample parameter for registration api virtual account snap request parameter curl curl x post "https //dev nicepay co id/nicepay/api/v1 0/transfer va/create va" \\ h "content type application/json" \\ h "authorization bearer eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" \\ h "x timestamp 2024 04 30t10 11 40+07 00" \\ h "x signature ufbw7r8rhw79ioiv/hlv607m60qzaybv8uzmbsryb6/thlo/fhqvp4xryeluehoss9o+qs6vwtkb/ygtucc+tq==" \\ h "x partner id ionpaytest" \\ h "x external id txid202410142300021707638093" \\ h "channel id ionpaytest" \\ d '{ "partnerserviceid" "", "customerno" "", "virtualaccountno" "", "virtualaccountname" "john doe", "trxid" "2022020100000000000001", "totalamount" { "value" "10000 00", "currency" "idr" }, "additionalinfo" { "bankcd" "bmri", "goodsnm" "john doe", "dbprocessurl" "https //testing co id/", "vacctvaliddt" "", "vacctvalidtm" "", "msid" "", "msfee" "", "msfeetype" "", "mbfee" "", "mbfeetype" "" } }' node js const config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid cons clientid, iscloudserver false, }; const parameter = { body { partnerserviceid "", customerno "", virtualaccountno "", virtualaccountname "john doe", trxid "2022020100000000000001", totalamount { value "10000 00", currency "idr", }, additionalinfo { bankcd "bmri", goodsnm "john doe", dbprocessurl "https //testing co id/", vacctvaliddt "", vacctvalidtm "" }, }, headers { x external id "txid202410142300021707638093", channel id "ionpaytest", }, }; let snap = new snap(config); let endpoint = `/api/v1 0/transfer va/create va`; let response = snap requestsnaptransaction(parameter, endpoint, accesstoken, "post"); config = nicepay builder() isproduction(false) clientsecret(data client secret) partnerid(partner id) externalid(data external id) timestamp("2024 04 30t10 11 40+07 00") privatekey(data private key) build(); var accesstoken = optional ofnullable((nicepayresponse) gettoken()) map(nicepayresponse getaccesstoken) orelsethrow(() > new illegalargumentexception("token is null")); virtualaccount virtualaccount = virtualaccount builder() partnerserviceid("") customerno("") virtualaccountno("") virtualaccountname("john doe") trxid("2022020100000000000001") totalamount("10000 00","idr") additionalinfo(new hashmap\<string, object>() { { put("bankcd","bmri"); put("goodsnm", "john doe"); put("dbprocessurl", "https //testing co id/"); put("vacctvaliddt", ""); put("vacctvalidtm", ""); put("msid", ""); put("msfee", ""); put("msfeetype", ""); put("mbfee", ""); put("mbfeetype", ""); } }) build(); nicepayresponse response = snapvaservice callgeneratedva(virtualaccount, accesstoken, config); bodycreatetoken = ( builderaccesstoken buildaccesstoken() setgranttype("client credentials") setadditionalinfo("") build() ) totalamount = { "value" "10000 00", "currency" "idr" } additionalinfo = { "bankcd" "bmri", "goodsnm" "john doe", "dbprocessurl" "https //testing co id/", "vacctvaliddt" "", "vacctvalidtm" "", "msid" "", "msfee" "", "msfeetype" "", "mbfee" "", "mbfeetype" "" } bodycreateva = ( buildervirtualaccount buildcreateva() setpartnerserviceid("") setcustomerno("") setvirtualaccountno("") setvirtualaccountname("john doe") settrxid("2022020100000000000001") settotalamount(totalamount) setadditionalinfo(additionalinfo) build() ) environment = ( builderenvironment buildenvironment() iscloud(false) isproduction(false) build() ) result = snapservice servicetransaction( bodycreatetoken jsonaccesstoken(), bodycreateva jsonvacreate(), constantsendpoints createva(), environment ) c# testingconstantservice config = new testingconstantservice(); string clientid = config clientid; string privatekey = config privatekey; string timestamp = "2024 04 30t10 11 40+07 00"; string clientsecret = config clientsecret; string channelid = "ionpaytest"; string externalid = "txid202410142300021707638093"; bool isproduction = false; bool iscloudserver = false; string accesstoken = accesstokenobject accesstoken; apiendpoints apiendpoints = new apiendpoints(); apiservice vaservice = new apiservice(apiendpoints, clientsecret, clientid, channelid, isproduction, iscloudserver); var bodybuilder = new virtualaccountbuilder() setvirtualaccountsnap( partnerserviceid "", customerno "", virtualaccountno "", virtualaccountname "john doe", trxid "2022020100000000000001", value "10000 00", currency "idr", bankcd "bmri", goodsnm "john doe", dbprocessurl "https //testing co id/", vacctvaliddt "", vacctvalidtm "", msid "", msfee "", msfeetype "", mbfee "", mbfeetype "" ) build(); string createresponse = await vaservice sendpostrequest(apiendpoints createva, accesstoken, timestamp, bodybuilder, externalid); laravel protected $useprod = false; protected $usecloud = false; protected $create va endpoint = "/api/v1 0/transfer va/create va"; protected $client id = "client key merchant"; protected $key = " private key merchant"; protected $client secret = " client secret merchant"; protected $access token = " access token merchant"; $url = httputil getnicepaydomain($this >useprod, $this >usecloud) "/nicepay" $this >create va endpoint; $helper = new helpers(); $http method = "post"; $date = carbon now(); $x time stamp = $date >toiso8601string(); $time stamp = $date >format("ymdhis"); $partner id = $this >client id; $client secret = $this >client secret; $access token = $helper >generateaccesstoken($this >client id, $this >key); $external id = "txid202410142300021707638093"; $totalamount = \[ "value" => "15000 00", "currency" => "idr" ]; $additionalinfo = \[ "bankcd" => "cena", "goodsnm" => "cena", "dbprocessurl" => "https //ptsv2 com/t/jhon/post", "vacctvaliddt" => "", "vacctvalidtm" => "", "msid" => "", "msfee" => "", "mbfee" => "", "mbfeetype" => "" ]; $body = \[ "partnerserviceid" => "", "customerno" => "", "virtualaccountno" => "", "virtualaccountname" => "testing create virtual account nicepay", "trxid" => "2022020100000000000001", "totalamount" => $totalamount, "additionalinfo" => $additionalinfo ]; $string to sign = $helper >generatestringtosign( $http method, $this >create va 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, $partner id "02" ); try { $response = httputil postjsonrequestwithheader($url, $body, $header); } catch (\exception $e) { echo "request failed " $e >getmessage(); } php native $timestamp = "2024 04 30t10 11 40+07 00"; $externalid = "txid202410142300021707638093"; $config = nicepay builder() >setisproduction(false) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid($this >imidtest) >setexternalid($externalid) >settimestamp($timestamp) >build(); $virtualaccountbuilder = virtualaccount builder(); $parameter = $virtualaccountbuilder >setpartnerserviceid("") >setcustomerno("") >setvirtualaccountno("") >setvirtualaccountname("john doe") >settrxid("2022020100000000000001") >settotalamount("10000 00", "idr") >setadditionalinfo(\[ 'bankcd' => 'bmri', 'goodsnm' => 'john doe', 'dbprocessurl' => 'https //testing co id/', 'vacctvaliddt' => '', 'vacctvalidtm' => '', 'msid' => '', 'msfee' => '', 'msfeetype' => '', 'mbfee' => '', 'mbfeetype' => '' ]) >build(); $accesstoken = self getaccesstoken($config); $snapvaservice = new snapvaservice($config); $response = $snapvaservice >generateva($parameter, $accesstoken); val config nicepay = nicepay builder() isproduction(false) clientsecret(testingconstants ionpaytest client secret) partnerid("ionpaytest") externalid("txid202410142300021707638093") timestamp("2024 04 30t10 11 40+07 00") privatekey(testingconstants private key) build() val accesstoken = "eyj0exaioijkv1qilcjhbgcioijiuzi1nij9 eyjzdwiioijjt05qqvlurvnuiiwiaxnzijoitkldrvbbwsisim5hbwuioijcukloiiwizxhwijoimjaync0wmi0xmvqwodowotoznvoifq== aiyblx36dywffvw7dcoenxkoe2eawiyq84ztpuif3k8=" val snapvirtualaccountservice snapvirtualaccountservice = snapvirtualaccountserviceimpl() val virtualaccount = snapvirtualaccount builder() partnerserviceid("1234") customerno("") virtualaccountno("") virtualaccountname("testvaname") trxid(default reference no) totalamount(default amount, "idr") additionalinfo( mapof( "bankcd" to "brin", "goodsnm" to "testgoodsnm", "dbprocessurl" to "https //merchant com/test", "vacctvaliddt" to "", "vacctvalidtm" to "", "msid" to "", "msfee" to "", "msfeetype" to "", "mbfee" to "", "mbfeetype" to "" ) ) build() val response nicepayresponse? = snapvirtualaccountservice createva(virtualaccount, accesstoken, config) codeigniter $const = new nicepaytestconst(); $this >clientsecret = $const imid test client secret; $this >oldkeyformat = $const imid test private key; $this >imidtest = $const imid test; $this >merchantkey = $const imid common merchant key; $timestamp = helper getformatteddate(); $config = nicepay builder() >setiscloudserver(iscloudserver true) >setprivatekey($this >oldkeyformat) >setclientsecret($this >clientsecret) >setpartnerid($this >imidtest) >setexternalid("txid202410142300021707638093") >settimestamp($timestamp) >build(); $virtualaccountbuilder = virtualaccount builder(); $parameter = $virtualaccountbuilder >setpartnerserviceid("") >setcustomerno("") >setvirtualaccountno("") >setvirtualaccountname("nicepay php test") >settrxid("2022020100000000000001") >settotalamount('10000 00', 'idr') >setadditionalinfo(\[ 'bankcd' => 'bmri', 'goodsnm' => 'jhon doe', 'dbprocessurl' => 'https //dev nicepay co id/ionpay client/paymentresult jsp', ]) >build(); $accesstoken = self getaccesstoken($config); $snapvaservice = new snapvaservice(); try { $response = $snapvaservice >generateva($parameter, $accesstoken, $config); } catch (\exception $e) { // handle exception if needed } response parameter sample response { "responsecode" "2002700", "responsemessage" "successful", "virtualaccountdata" { "partnerserviceid" "", "customerno" "", "virtualaccountno" "70014000091733551548", "virtualaccountname" "jhon doe", "trxid" "2022020100000000000001", "totalamount" { "value" "10000 00", "currency" "idr" }, "additionalinfo" { "msid" "", "msfee" "", "msfeetype" "", "mbfee" "", "mbfeetype" "", "bankcd" "bmri", "txidva" "ionpaytest02202410141733551548", "goodsnm" "jhon doe", "vacctvaliddt" "20241016", "vacctvalidtm" "173355" } } }