NICEPAY API
...
Account Binding - API E-Wallet...
Access Token B2B & B2B2C - API E-Wallet (Direct Debit) SNAP
23 min
about access token b2b & b2b2c api e wallet (direct debit) snap this part contains detail {{information}} related to {{api}} access token needs with {{snap}} standardization used to {{proceed}} {{the}} {{process}} related to b2b and b2b2c access token b2b account binding api e wallet (direct debit) snap {{visit}} {{the}} docid 9xl2y9tokxgtmzsu8v8l0 {{page}} to know {{the}} flow how to obtain an access token during {{the}} account binding {{process}} access token b2b used by {{the}} {{merchant}} to initiate {{transaction}} {{process}} with {{nicepay}} {{system}} service code 73 api endpoint /nicepay/v1 0/access token/b2b method post description get access token b2b specification request header parameter for access token b2b account binding api e wallet (direct debit) snap parameter type length mandatory description content type string variable mandatory application/json x timestamp string variable mandatory yyyy mm ddthh\ mm\ ss ssstzd (2022 03 21t10π40+07 00) x client key string variable mandatory {{nicepay}} credential client id x signature string variable mandatory x signature created using asymmetric signature sha256withrsa algorithm ( private key , stringtosign ) stringtosign = client id + β|β + x timestamp request body parameter for access token b2b account binding api e wallet (direct debit) snap parameter type length mandatory description granttype string variable mandatory grant type value β client credentials β additionalinfo json object variable mandatory additional information response header parameter for access token b2b account binding api e wallet (direct debit) snap parameter type length mandatory description content type string variable mandatory content type, value always application/json x timestamp string variable mandatory transaction date time, in format yyyy mmddthh\ mm\ ss+07 00 time must be in gmt+7 (jakarta time) response body parameter for access token b2b account binding api e wallet (direct debit) snap parameter type length mandatory description responsecode string variable mandatory refer to response code list responsemessage string variable mandatory debug message to provide more {{information}} accesstoken string 2048 mandatory token authorization that {{nicepay}} used for shopee pay {{api}} services tokentype string variable mandatory token type value βbearerβ expiresin string 3 mandatory token validate time sample parameter for access token b2b account binding api e wallet (direct debit) snap request parameter curl curl x post \\ 'https //dev nicepay co id/nicepay/v1 0/access token/b2b' \\ h 'content type application/json' \\ h 'x signature afhq5sndwo5pq2vwzk4ztd9cu3ovblg6nezgwlx3gc2mrjordhpezpr3v+rxrpc8ojcycwqy01fsipma8ydqvz1hoth7aekxzhigycrns34ehyeofgd1ymhvfrvxn2fu8had6wtvpny2x2rbus3hwrjsfa5chu8wkvb7zpcuxnc=' \\ h 'x client key ionpaytest' \\ h 'x timestamp 2024 01 31t10 11 40+07 00' \\ d '{"granttype" "client credentials", "additionalinfo" {}}' node js const config = { isproduction false, privatekey cons privatekey, clientsecret cons clientsecret, clientid "ionpaytest", iscloudserver false, externalid "exid202402111402271707638098", timestamp "2024 01 31t10 11 40+07 00", }; const tokenbody = { "granttype " "client credentials", "additionalinfo" {} }; let snap = new snap(config); let response = snap requestsnapaccesstoken(tokenbody);config = nicepay builder() isproduction(false) clientsecret("your client secret") partnerid("ionpaytest") externalid("exid202402111402271707638098") timestamp("2024 01 31t10 11 40+07 00") privatekey("your private key") build(); accesstoken accesstoken = accesstoken builder() granttype("client credentials") additionalinfo(new hashmap<>()) build(); nicepayresponse result = snaptokenservice callgetaccesstoken(accesstoken, config);bodycreatetoken = ( builderaccesstoken buildaccesstoken() setgranttype("client credentials") setadditionalinfo({}) build() ) environment = (builderenvironment buildenvironment() iscloud(false) isproduction(false) build()) result = snapservice serviceoauth(bodycreatetoken jsonaccesstoken(), environment) c# const string client id = "ionpaytest"; const string x timestamp = "2024 01 31t10 11 40+07 00"; const bool is production = false; const bool is cloud server = false; // generate signature using values directly string signature = signaturegeneratorutils generatesignature(config privatekey, client id, x timestamp); // get access token var tokenrequester = new accesstokenrequester(); string accesstokenresponse = await tokenrequester getaccesstokenasync(client id, signature, x timestamp, is production, is cloud server); dynamic accesstokenobject = jobject parse(accesstokenresponse); string accesstoken = accesstokenobject accesstoken; laravel protected $useprod = false; protected $usecloud = false; protected $access token endpoint = "/nicepay/v1 0/access token/b2b"; protected $client id = "ionpaytest"; protected $key = " private key merchant"; $url = httputil getnicepaydomain($this >useprod, $this >usecloud) $this >access token endpoint; $helper = new helpers(); $x time stamp = "2024 01 31t10 11 40+07 00"; $client id = $this >client id; $bd = \[ "granttype" => "client credentials", "additionalinfo" => new \stdclass() ]; $string to sign = $client id "|" $x time stamp; $signature = $helper >generatesignature($string to sign, $this >key, openssl algo sha256); $header = $helper >generateheaderaccesstoken($x time stamp, $client id, $signature); try { $response = http withheaders($header) >post($url, $bd); } catch (exception $e) { // handle exception } php native const string partner id = "ionpaytest"; const string x timestamp = "2024 01 31t10 11 40+07 00"; const string x external id = "exid202402111402271707638098"; $config = nicepay builder() >setisproduction(false) >setprivatekey(" your private key ") >setclientsecret(" your client secret ") >setpartnerid(partner id) >setexternalid(x external id) >settimestamp(x timestamp) >build(); $tokenbody = accesstoken builder() >setgranttype('client credentials') >setadditionalinfo(\[]) >build(); $snap = new snap($config); try { $response = $snap >requestsnapaccesstoken($tokenbody); } catch (\exception $e) { // handle exception }const val partner id = "ionpaytest" const val external id = "exid202402111402271707638098" // used for general context consistency const val timestamp = "2024 01 31t10 11 40+07 00" // step 1 initialize the nicepay configuration var config nicepay = nicepay builder() isproduction(false) clientsecret("your client secret") // placeholder partnerid(partner id) externalid(external id) timestamp(timestamp) privatekey("your private key") // placeholder build() val service snapaccesstokenservice = snapaccesstokenserviceimpl() // step 2 define the access token request body val request = accesstoken builder() granttype("client credentials") additionalinfo(emptymap()) build() // step 3 execute the access token request val response = service getaccesstoken(request, config) codeigniter response parameter sample response { "responsecode" "2007300", "responsemessage" "successful", "accesstoken" "xy8duzzavv9bwdxxrxcb89tsuvk4mf4kx4lgfe4acrvxr7xderhbe1", "tokentype" "bearer", "expiresin" "900" } access token b2b2c account binding api e wallet (direct debit) snap access token b2b2c used by {{the}} {{merchant}} to initiate {{the}} {{customer}} {{transaction}} {{process}} using a linked account with {{nicepay}} {{system}} service code 74 api endpoint /nicepay/v1 0/access token/b2bc method post description get access token b2b2c specification request header parameter for access token b2b2c account binding api e wallet (direct debit) snap parameter type length mandatory description content type string variable mandatory application/json x timestamp string variable mandatory yyyy mm ddthh\ mm\ ss ssstzd (2022 03 21t10π40+07 00) x client key string variable mandatory {{nicepay}} credential client id x signature string variable mandatory x signature created using asymmetric signature sha256withrsa algorithm ( private key , stringtosign ) stringtosign = client id + β|β + x timestamp request body parameter for access token b2b2c account binding api e wallet (direct debit) snap parameter type length mandatory description granttype string 32 mandatory apply token request key type, can be authorization code or refresh token authcode string 256 conditional the authorization code received after {{the}} user provides {{the}} consent mandatory if granttype = authorization code refreshtoken string 512 conditional refresh token to get a new accesstoken where {{the}} user doesn't need to provide {{the}} consent again mandatory if granttype = refresh token refresh token should be less than access token validity and will be manage by {{the}} pjpβs application to generate a new access token additionalinfo json object variable mandatory additional {{information}} partnerreferenceno string 40 mandatory {{merchant}} {{transaction}} identifier from {{nicepay}} mitracd string 4 mandatory {{nicepay}} {{mitra}} code astrapay astr allobank allo response header parameter for access token b2b2c account binding api e wallet (direct debit) snap parameter type length mandatory description content type string variable mandatory content type, value always application/json x timestamp string variable mandatory transaction date time, in format yyyy mmddthh\ mm\ ss+07 00 time must be in gmt+7 (jakarta time) response body parameter for access token b2b2c account binding api e wallet (direct debit) snap parameter type length mandatory description responsecode string 7 mandatory refer to response code list responsemessage string 40 mandatory debug message to provide more {{information}} accesstoken string 50 mandatory authorization in {{the}} form of a string given to {{the}} user and used to access protected resources tokentype string 50 mandatory bearer token accesstokenexpirytime string 50 mandatory access token valid time will be 15 days format iso8601 refreshtoken string 50 mandatory random string used by {{the}} user to get a new accesstoken to access user data by format uuid refreshtokenexpirytime string 50 mandatory time for {{the}} refreshtoken to expire additionalinfo json object variable mandatory additional {{information}} partnerreferenceno string 40 mandatory {{merchant}} {{transaction}} identifier from {{nicepay}} referenceno string 40 mandatory {{nicepay}} transaction id mitracd string 4 mandatory {{nicepay}} {{mitra}} code astrapay astr allo bank allo sample parameter for access token b2b2c account binding api e wallet (direct debit) snap request parameter curl curl x post \\ 'https //dev nicepay co id/nicepay/v1 0/access token/b2bc' \\ h 'content type application/json' \\ h 'x signature afhq5sndwo5pq2vwzk4ztd9cu3ovblg6nezgwlx3gc2mrjordhpezpr3v+rxrpc8ojcycwqy01fsipma8ydqvz1hoth7aekxzhigycrns34ehyeofgd1ymhvfrvxn2fu8had6wtvpny2x2rbus3hwrjsfa5chu8wkvb7zpcuxnc=' \\ h 'x client key ionpaytest' \\ h 'x timestamp 2024 01 31t10 11 40+07 00' \\ d '{"granttype" "authorization code","authcode" "3p8uuq0dkdbpagbvbfio1qodnzzajjxxitpl9mfrswas","refreshtoken" "3911773a d3ac 4b4f 8a6c 406c21d6883d","additionalinfo" {"partnerreferenceno" "202208121451526358","mitracd" "astr"}}' response parameter sample response { "granttype" "authorization code", "authcode" "3p8uuq0dkdbpagbvbfio1qodnzzajjxxitpl9mfrswas", "refreshtoken" "3911773a d3ac 4b4f 8a6c 406c21d6883d", "additionalinfo" { "partnerreferenceno" "202208121451526358", "mitracd" "astr" } }