NICEPAY API
...
Payment - API Credit Card
Recurring - Payment API Credit Card
21 min
tentang recurring payment api credit card pembayaran tipe recurring adalah fitur lain dari {{kartukredit}} {{yang}} dapat melakukan {{pembayaran}} suatu tagihan dari {{pelanggan}} {{anda}} secara berkala dengan nominal {{yang}} sama seperti {{yang}} ditagihkan pada awal {{pembayaran}} {{api}} {{yang}} digunakan pada tahap {{pembayaran}} ini sama dengan {{api}} untuk {{pembayaran}} tipe full {{paymentproduct}} & installment dan pre auth & capture namun, terdapat perbedaan pada request {{parameter}} {{yang}} dikirimkan {{nicepay}} akan memberikan sebuah recurringtoken sebagai {{parameter}} {{paymentproduct}} {{api}} response {{yang}} disebut sebagai recurring token making {{merchant}} dapat menggunakan recurringtoken pada {{paymentproduct}} {{api}} request selanjutnya tanpa menggunakan cardno dan cardexpyymm recurring payment api credit card (first payment) untuk dapat mengaktifkan {{transaksi}} {{kartukredit}} dengan jenis recurring , {{anda}} wajib membayarkan {{transaksi}} {{yang}} sudah dibuat untuk mendapatkan recurringtoken terlebih dahulu api endpoint /nicepay/direct/v2/payment method application/x www form urlencoded application/x www form urlencoded post post description recurring {{paymentproduct}} {{cc}} merchant token sha256( timestamp + imid + referenceno + amt + merchantkey ) spesifikasi {{api}} {{yang}} digunakan sama dengan docid\ ylje0zpb9xkbfa0e0mrzc request parameter for recurring payment api credit card (first payment) berikut adalah request payment pada recurring untuk mendapatkan recurringtoken {{yang}} di mana {{anda}} diperlukan untuk menyelesaikan docid\ ylje0zpb9xkbfa0e0mrzc terlebih dahulu {{anda}} masih membutuhkan cardno , cardexpyymm , cardcvv , cardholdernm & cardholderemail dari {{pelanggan}} pada {{pembayaran}} pertama dalam skema recurring ini parameter tipe ukuran deskripsi contoh / catatan timestamp required required n 14 request timestamp ( yyyymmddhh24miss ) 20230522080502 txid required required an 30 transaction id ionpaytest01202305220041509298 referenceno required required ans 40 {{merchant}} order number merchantreferencenumber001 merchanttoken required required an 255 {{merchant}} token ff139e49606387091cd9baeadff3161aff6afd9406e1f481e0fdb8b46d1ae5ae cardno required required n 20 {{cc}} number 51234500 0000 cardexpyymm required required a 4 card expiry ( yymm ) 3901 cardcvv required required n 4 card cvv 100 cardholdernm required required an 45 card holder name john doe only alphabet allowed cardholderemail required required ans 100 card holder email johndoe\@gmail com callbackurl required required ans 255 {{paymentproduct}} result url https //www nicepay co id/ionpay client/paymentresult jsp response parameter for recurring payment api credit card (first payment) berikut adalah rincian response {{yang}} {{anda}} dapatkan mohon untuk melakukan save & store recurringtoken {{yang}} sudah didapat demi menjalankan {{proses}} fitur recurring pada {{transaksi}} selanjutnya dengan {{kartukredit}} {{pelanggan}} {{yang}} sama parameter tipe ukuran deskripsi contoh / catatan timestamp n 14 response date ( yyyymmddhh24miss ) 20230520135959 resultcd n 4 docid 7o8nl7guqp asiwfdqi3v 0000 resultmsg an 255 docid\ wpcemazro xvnxz 1zaib success txid an 30 transaction id ionpaytest01202305161007570327 referenceno ans 40 {{merchant}} order number merchantreferencenumber001 paymethod n 2 docid\ iifmsruuw7j9vmwefjz97 01 when success amount n 12 {{paymentproduct}} amount 10000 when success currency an 3 currency idr when success goodsnm an 100 goods name {{merchant}} goods 1 when success billingnm an 100 buyer name john doe when success transdt n 8 transaction date ( yyyymmdd ) 20230516 when success transtm n 6 transaction time ( hh24miss ) 135959 when success description an 100 transaction description this is the description of the {{paymentproduct}} when success authno n 10 approval number 123456 when success issubankcd a 4 docid\ ky4ppujot06atnie easf cena (refer {{bank}} code) when success acqubankcd a 4 docid\ ky4ppujot06atnie easf bnia (refer {{bank}} code) when success cardno an 20 card number (masked) 51234500 0008 when success cardexpyymm n 4 card expiry ( yymm ) 3901 when success instmntmon n 1 installment month 1 when success instmnttype n 2 docid\ rt2c32s9hfl aohyoebv5 1 when success cctranstype an 2 docid 5kylpx5mpjsl96c8mhoik 1 normal 2 recurring 3 pre auth 4 capture 2 when success vat n 12 value added tax ( {{vat}} ) 0 when success fee n 12 service fee 0 when success notaxamt n 12 tax free amount 0 when success recurringtoken an 64 token that using recurring {{paymentproduct}} f19e3128784d0b33c189d5df21321c781b5bd107b185587fd8a54781aa845c84 acqubanknm a 255 acquiring {{bank}} name cimb issubanknm a 255 issuing {{bank}} name bca sample parameter for recurring payment api credit card (first payment) request parameter curl curl location 'https //dev nicepay co id/nicepay/direct/v2/payment' \\ \ header 'x forwarded for 1 2 3' \\ \ header 'content type application/x www form urlencoded' \\ \ data urlencode 'timestamp=20250930150955' \\ \ data urlencode 'txid=recurrtest01202509301555563979' \\ \ data urlencode 'referenceno=ordno20250930150915' \\ \ data urlencode 'merchanttoken=bc2ee7790486a7ee4a5313d4c1d4088a38456b89204e308ae38e0beee3849d0b' \\ \ data urlencode 'cardno=5123450000000008' \\ \ data urlencode 'cardexpyymm=3106' \\ \ data urlencode 'cardcvv=100' \\ \ data urlencode 'cardholdernm=nicepay test' \\ \ data urlencode 'callbackurl=https //dev nicepay co id/ionpay client/paymentresult jsp?order id=recurrtest01202509301555563979' node js let secondversion = new secondapiversion(config); let parameterpayment = { amt "1000", referenceno "ordno20250930150915", txid "recurrtest01202509301555563979", cardno "5123450000000008", callbackurl "https //dev nicepay co id/ionpay client/paymentresult jsp?order id=recurrtest01202509301555563979", cardexpyymm "3106", cardcvv "100", recurringtoken "", // leave empty for first payment cardholdernm "nicepay test", preauthtoken "", cardholderemail "test\@email com", }; let response = secondversion requestpayment(parameterpayment);nicepay config = nicepay builder() isproduction(false) // set to true for production build(); card requestdata = card builder() timestamp("20250922143200") // current timestamp (yyyymmddhhmmss) txid("recurrtest01202509301555563979") // transaction id from registration imid("recurrtest") // your nicepay imid referenceno("ordno20250930150915") // unique order reference amt("1000") // payment amount merchanttoken(timestamp, imid, reffno, amount, merchant key) // secure token generation cardno("5123450000000008") // test card number cardexpyymm("3601") // card expiry date (yymm) cardcvv("100") // 3 digit cvv cardholdernm("nicepay test") // cardholder name callbackurl("https //www nicepay co id/ionpay client/paymentresult jsp") // callback url recurringtoken("") // leave empty for first payment preauthtoken("") // leave empty if not pre auth build(); string responsehtml = v2cardservice callv2cardpaymentrequest(requestdata, config); bodypayment = ( builderpayment buildpayment() settimestamp(datetime now() strftime("%y%m%d%h%m%s")) # current timestamp (yyyymmddhhmmss) settxid("testmpgs0501202510011026450166") # transaction id from registration setreferenceno("ordno20250930150915") # unique order reference setcashtag("") # leave empty if not using cashtag setcardno("5123450000000008") # test card number setcardexpyymm("3901") # card expiry date (yymm) setcardcvv("100") # 3 digit cvv setrecurringtoken("") # leave empty if not recurring setpreauthtoken("") # leave empty for hold fund request setamt("1000") # payment amount build() ) environment = ( builderenvironment buildenvironment() iscloud(false) # set to true if using nicepay cloud isproduction(false) # set to true for production build() ) response = servicenicepay servicepayment( datagenerator getpaymentbody(bodypayment datapayment()), environment ) vanilla js const paymentdata = { cardno "5123450000000008", // test card number cardexpyymm "3601", // card expiry in yymm format cardcvv "100", // 3 digit cvv cardholderemail "customer\@example com", // cardholder email cardholdernm "nicepay test", // cardholder name callbackurl "https //your domain com/callback", // callback url after payment txid "recurrtest01202509301555563979", // transaction id from registration merchanttoken "bc2ee7790486a7ee4a5313d4c1d4088a38456b89204e308ae38e0beee3849d0b", // secure token recurringtoken "", // leave empty for first payment }; const response = await nicepay paymenttransaction(paymentdata); laravel $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >payment endpoint; // request body parameters $txid = "recurrtest01202509301555563979"; $timestamp = carbon now() >format("ymdhis"); // current timestamp (yyyymmddhhmmss) $reference no = "ordno20250930150915"; $amt = "1000"; // generate secure merchant token $merchant token = $this >generatemerchanttoken( $timestamp, $this >imid, $reference no, $amt, $this >mer key ); $param = \[ "timestamp" => $timestamp, // current timestamp "txid" => $txid, // transaction id from registration "merchanttoken" => $merchant token, // secure hash token "cardno" => "5123450000000008", // test card number "cardexpyymm" => "3901", // card expiry date (yymm) "cardcvv" => "100", // 3 digit cvv "callbackurl" => "https //www nicepay co id/ionpay client/paymentresult jsp", // callback url "returnjsonformat"=> "1", // force json response format "recurringtoken" => "", ]; $response = httputil redirectwithqueryparams($url, $param); php native $config = nicepay builder() >setisproduction(true) // set to false for sandbox/testing >build(); $parameter = card builder() >timestamp($timestamp) // current timestamp (yyyymmddhhmmss) >imid("testmpgs05") // your nicepay imid >txid("testmpgs0501202510011026450166") // transaction id from registration >referenceno("ordno20251001101069") // unique order reference >merchanttoken( $timestamp, $imid, $referenceno, $amt, $this >merchantkey ) // generate secure token >cardno(testconst $card no) // test card number from constants >cardexpyymm(testconst $card exp yymm) // card expiry date (yymm) >cardcvv(testconst $card cvv) // 3 digit cvv >cardholdernm("nicepay test") // cardholder name >callbackurl("https //dev nicepay co id/ionpay client/paymentresult jsp?") // callback url after payment >recurringtoken("") >build(); $cardservice = new v2cardservice($config); $response = $cardservice >payment($parameter); var config nicepay? = nicepay builder() isproduction(true) // set to false for sandbox/testing build() val request directv2requestpaymentcard = directv2requestpaymentcard builder() timestamp("20250922143200") // current timestamp (yyyymmddhhmmss) txid("recurrtest01202509301555563979") // transaction id from registration imid("recurrtest") // your nicepay imid merchantkey(merchant key) // secret merchant key referenceno("ordno20250930150915") // unique order reference number amt("1000") // payment amount callbakurl("https //www nicepay co id/ionpay client/paymentresult jsp") // callback url after payment cardno("5123450000000008") // test card number cardcvv("123") // 3 digit cvv (sample) cardexpyymm("3601") // card expiry date (yymm) recurringtoken("") // left empty for first payment build() val response = paymentservice registration(request, config)!! response parameter sample response continual recurring payment api credit card setelah melakukan {{pembayaran}} pertama dan telah mendapatkan recurringtoken pada /#recurring payment api credit card first payment {{anda}} dapat menggunakan recurringtoken tersebut untuk melakukan {{pembayaran}} tagihan lain menggunakan kredensial {{kartukredit}} {{pelanggan}} {{yang}} sama demi menerapkan mekanisme {{pembayaran}} secara berkala atau recurring (subscription) namun, untuk menjalankan {{proses}} payment continual recurring ini, {{anda}} tetap diperlukan untuk melakukan registrasi {{transaksi}} terlebih dahulu pada docid\ ylje0zpb9xkbfa0e0mrzc berikut adalah rincian request dan response {{yang}} digunakan pada {{pembayaran}} berikutnya menggunakan recurring token {{yang}} sama api endpoint /nicepay/direct/v2/payment method application/x www form urlencoded application/x www form urlencoded post post description recurring continual {{paymentproduct}} {{cc}} merchant token sha256( timestamp + imid + referenceno + amt + merchantkey ) spesifikasi {{api}} {{yang}} digunakan sama dengan docid\ ylje0zpb9xkbfa0e0mrzc request payment for continual recurring payment api credit card {{anda}} hanya perlu menggunakan recurringtoken pada {{paymentproduct}} {{api}} recurring untuk request selanjutnya ini tanpa menggunakan {{parameter}} cardno dan cardexpyymm parameter tipe ukuran deskripsi contoh / catatan timestamp required required n 14 request timestamp ( yyyymmddhh24miss ) 20230522080502 txid required required an 30 transaction id ionpaytest01202305220041509298 referenceno required required ans 40 {{merchant}} order number merchantreferencenumber001 merchanttoken required required an 255 {{merchant}} token ff139e49606387091cd9baeadff3161aff6afd9406e1f481e0fdb8b46d1ae5ae recurringtoken required required a n 64 token that using recurring payment when success f19e3128784d0b33c189d5df21321c781b5bd107b185587fd8a54781aa845c84 cardcvv required required n 4 card cvv 100 cardholdernm required required an 45 card holder name john doe only alphabet allowed cardholderemail required required ans 100 card holder email johndoe\@gmail com callbackurl required required ans 255 {{paymentproduct}} result url https //www nicepay co id/ionpay client/paymentresult jsp mencantumkan cardcvv pada setiap {{transaksi}} bergantung dari mid tipe cvv atau non cvv response payment for continual recurring payment api credit card parameter tipe ukuran deskripsi contoh / catatan timestamp n 14 response date ( yyyymmddhh24miss ) 20230520135959 resultcd n 4 docid 7o8nl7guqp asiwfdqi3v 0000 resultmsg an 255 docid\ wpcemazro xvnxz 1zaib success txid an 30 transaction id ionpaytest202206230959067259 referenceno ans 40 {{merchant}} order number merchantreferencenumber001 paymethod n 2 docid\ iifmsruuw7j9vmwefjz97 01 when success amt n 12 payment amount 10000 when success currency an 3 currency idr when success goodsnm an 100 goods name merchant goods 1 when success billingnm an 100 buyer name john doe when success transdt n 8 transaction date ( yyyymmdd ) 20230516 when success transtm n 6 transaction time ( hh24miss ) 135959 when success description an 100 transaction description this is the description of the {{paymentproduct}} when success authno n 10 approval number 123456 when success issubankcd a 4 docid\ qbeq29lj53z vbvxtvb7l cena (refer {{bank}} code) when success acqubankcd a 4 docid\ qbeq29lj53z vbvxtvb7l cena (refer {{bank}} code) when success cardno an 20 card number (masked) 51234500 0008 when success cardexpyymm n 4 card expiry ( yymm ) 3901 when success instmntmon n 1 installment month 1 when success instmnttype n 2 docid\ rt2c32s9hfl aohyoebv5 1 when success cctranstype an 2 docid 5kylpx5mpjsl96c8mhoik 1 normal 2 recurring 3 pre auth 4 capture 2 when success vat n 12 value added tax ( {{vat}} ) 0 when success fee n 12 service fee 0 when success notaxamt n 12 tax free amount 0 when success acqubanknm a 255 acquiring {{bank}} name cimb issubanknm a 255 issuing {{bank}} name bca sample parameter for continual recurring payment api credit card request parameter curl curl location 'https //dev nicepay co id/nicepay/direct/v2/payment' \\ \ header 'x forwarded for 1 2 3' \\ \ header 'content type application/x www form urlencoded' \\ \ header 'cookie jsessionid=95539d2a218bd0ba1ea20d10878b53e2 pg was1' \\ \ data urlencode 'timestamp=20250930170957' \\ \ data urlencode 'txid=recurrtest01202509301729488790' \\ \ data urlencode 'referenceno=ordno20250930170928' \\ \ data urlencode 'merchanttoken=7c60ad0bfb38e1599bbcee61e3bba438bf9f6ffbbaa0d1cfc561c9fdcd24f89d' \\ \ data urlencode 'cardholdernm=nicepay test' \\ \ data urlencode 'recurringtoken=20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035' \\ \ data urlencode 'callbackurl=https //dev nicepay co id/ionpay client/paymentresult jsp?order id=recurrtest01202509301729488790' node js let secondversion = new secondapiversion(config); let parameterpayment = { amt "1000", referenceno "ordno20250930170928", txid "recurrtest01202509301729488790", callbackurl "https //dev nicepay co id/ionpay client/paymentresult jsp?order id=recurrtest01202509301555563979", cardholdernm "nicepay test", recurringtoken "20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035", cardholderemail "test\@email com", }; let response = secondversion requestpayment(parameterpayment);nicepay config = nicepay builder() isproduction(false) // set to true for production build(); card requestdata = card builder() timestamp("20250922143200") // current timestamp (yyyymmddhhmmss) txid("recurrtest01202509301729488790") // transaction id from registration imid("recurrtest") // your nicepay imid referenceno("ordno20250930170928") // unique order reference amt("1000") // payment amount merchanttoken(timestamp, imid, reffno, amount, merchant key) // secure token generation cardholdernm("nicepay test") // cardholder name callbackurl("https //www nicepay co id/ionpay client/paymentresult jsp") // callback url recurringtoken("20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035") // leave empty for first payment preauthtoken("") // leave empty if not pre auth build(); string responsehtml = v2cardservice callv2cardpaymentrequest(requestdata, config); bodypayment = ( builderpayment buildpayment() settimestamp(datetime now() strftime("%y%m%d%h%m%s")) # current timestamp (yyyymmddhhmmss) settxid("recurrtest01202509301729488790") # transaction id from registration setreferenceno("ordno20250930170928") # unique order reference setcashtag("") setrecurringtoken("20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035") # leave empty if not recurring setpreauthtoken("") # leave empty if not pre auth setamt("1000") # payment amount build() ) environment = ( builderenvironment buildenvironment() iscloud(false) # set to true if using nicepay cloud isproduction(false) # set to true for production build() ) response = servicenicepay servicepayment( datagenerator getpaymentbody(bodypayment datapayment()), environment ) vanilla js const paymentdata = { cardholderemail "customer\@example com", // cardholder email cardholdernm "nicepay test", // cardholder name callbackurl "https //your domain com/callback", // callback url after payment txid "recurrtest01202509301729488790", // transaction id from registration merchanttoken "bc2ee7790486a7ee4a5313d4c1d4088a38456b89204e308ae38e0beee3849d0b", // secure token recurringtoken "20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035", // leave empty for first payment }; const response = await nicepay paymenttransaction(paymentdata); laravel $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >payment endpoint; // request body parameters $txid = "recurrtest01202509301729488790"; $timestamp = carbon now() >format("ymdhis"); // current timestamp (yyyymmddhhmmss) $reference no = "ordno20250930170928"; $amt = "1000"; // generate secure merchant token $merchant token = $this >generatemerchanttoken( $timestamp, $this >imid, $reference no, $amt, $this >mer key ); $param = \[ "timestamp" => $timestamp, // current timestamp "txid" => $txid, // transaction id from registration "merchanttoken" => $merchant token, // secure hash token "callbackurl" => "https //www nicepay co id/ionpay client/paymentresult jsp", // callback url "returnjsonformat"=> "1", // force json response format "recurringtoken" => "20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035", ]; $response = httputil redirectwithqueryparams($url, $param); php native $config = nicepay builder() >setisproduction(true) // set to false for sandbox/testing >build(); $parameter = card builder() >timestamp($timestamp) // current timestamp (yyyymmddhhmmss) >imid("ionpaytest") // your nicepay imid >txid("recurrtest01202509301729488790") // transaction id from registration >referenceno("ordno20250930170928") // unique order reference >merchanttoken( $timestamp, $imid, $newcctrx >getreferenceno(), $newcctrx >getamt(), $this >merchantkey ) // generate secure token >cardholdernm("nicepay test") // cardholder name >callbackurl("https //dev nicepay co id/ionpay client/paymentresult jsp?") // callback url after payment >recurringtoken("20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035") >build(); $cardservice = new v2cardservice($config); $response = $cardservice >payment($parameter); var config nicepay? = nicepay builder() isproduction(true) // set to false for sandbox/testing build() val request directv2requestpaymentcard = directv2requestpaymentcard builder() timestamp("20250922143200") // current timestamp (yyyymmddhhmmss) txid("recurrtest01202509301555563979") // transaction id from registration imid("recurrtest") // your nicepay imid merchantkey(merchant key) // secret merchant key referenceno("ordno20250930150915") // unique order reference number amt("1000") // payment amount callbakurl("https //dev nicepay co id/ionpay client/paymentresult jsp") // callback url after payment recurringtoken("20b50427bc05cba305b0d580bf403e3c8487db29454459a920b6af358e435035") // left empty for first payment build() val response = paymentservice registration(request, config)!! response parameter sample response callback handling for full payment & installment payment api credit card txid tidak akan sama dengan request hold proses capture akan memastikan bahwa nilai amount {{yang}} di capture tidak melebihi dana {{yang}} dimiliki saat callback telah diterima callbackurl {{anda}} , kami sangat menganjurkan {{merchant}} untuk melakukan verifikasi {{status}} menggunakan docid 9ivqi i4yka9s1oz6s ha callback handling dapat sangat membantu untuk meminimalisir terjadinya fraud , kami sangat merekomendasikan untuk melakukan verifikasi callback handling url callback "callbackurl" "https //www merchant com/callbackurl/" response callback { "resultcd" "0000", "resultmsg" "success", "txid" "ionpaytest01202212141112221428", "referenceno" "", "paymethod" "01", "amt" "10000", "transdt" "20221212", "transtm" "121212", "description" "testing credit card transaction", "authno" "080623", "issubankcd" "othr" "acqubankcd" "bmri", "cardno" "453211 1111", "goodsnm" "test transaction nicepay" "billingnm" "john doe", "currency" "idr", "timestamp" "20221212121212", "merchanttoken" "2035d2295d9578fffb40137186f0203474142ae3e57992d4847826c5fcaffce6", "cardexpyymm" "2712", "instmntmon" "1", "instmnttype" "1", "cctranstype" "1" }