Skip to content

OAuth Access Token DANA

Generate your access token to use DANA account binding. You have to keep the access token on your side. This process will remove 1 step, namely entering the HP number and PIN.

How to get access token? you should hit endpoint oauth DANA and will get access token in token notify url. You must submit this Access token in payment_options.token to bypass this account binding process.

Note : One token only allows one phone number

##JSON Attributes

NameData TypeRequiredDetails
token_notify_urlStringYesNotify URL
redirect_urlStringNoRedirect to merchant URL

##Information

Hostnamehttps://api-stage.ifortepay.id
Path/dana-oauth
HTTP MethodPOST

##Headers

KeyFormatRequiredValue
Content-Typeapplication/jsonM
AuthorizationStringMBasic
x-versionStringMv3

##Example

Body raw
json
{
    "token_notify_url": "{{notify_url}}",
    "redirect_url": "{{redirect_to_merchant_url}}"
}
Example Request
shell
curl --location 'https://api-stage.ifortepay.id/dana-oauth' \
--header 'Authorization: Basic {{Base64encodedKey}}' \
--header 'Content-Type: application/json' \
--header 'x-version: v3' \
--data '{
    "token_notify_url": "https://merchant.notify.url",
    "redirect_url": "https://redirect.to.merchant.url"
}'
go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://api-stage.ifortepay.id/dana-oauth"
  method := "POST"

  payload := strings.NewReader(`{
    "token_notify_url": "https://merchant.notify.url",
    "redirect_url": "https://redirect.to.merchant.url"
}`)

  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Basic {{Base64encodedKey}}")
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-version", "v3")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
js
var axios = require('axios');
var data = JSON.stringify({
  "token_notify_url": "https://merchant.notify.url",
  "redirect_url": "https://redirect.to.merchant.url"
});

var config = {
  method: 'post',
maxBodyLength: Infinity,
  url: 'https://api-stage.ifortepay.id/dana-oauth',
  headers: { 
    'Authorization': 'Basic {{Base64encodedKey}}', 
    'Content-Type': 'application/json', 
    'x-version': 'v3'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
php
use GuzzleHttp\Client;

$client = new Client();
$headers = [
  'Authorization' => 'Basic {{Base64encodedKey}}',
  'Content-Type' => 'application/json',
  'x-version' => 'v3'
];
$body = '{
  "token_notify_url": "https://merchant.notify.url",
  "redirect_url": "https://redirect.to.merchant.url"
}';
$request = new Request('POST', 'https://api-stage.ifortepay.id/dana-oauth', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();
Example Response
json
{
  "url": "https://url.for.generate.token"
}

iFortepay API Documentation