Skip to content
oabdoun edited this page Dec 4, 2014 · 8 revisions

Binding identified user to CitrusPay user

Binding is a 3 steps process:

  1. get a subscription OAuth token for binding
  2. do the user binding
  3. get a one-time OAuth token for bind user

Get a subscription OAuth token

This is a webservice call

  • protocol HTTPS
  • hostname admin.citruspay.com (live) or sandboxadmin.citruspay.com (integration)
  • method POST
  • path /oauth/token
  • Content-Type application/x-www-form-urlencoded
  • parameters
    • client_id your subscription oauth client id
    • client_secret your subscription oauth client secret
    • grant_type implicit

The OAuth subscription token is the access_token attribute of the returned JSON object. This token is longed lived, you can cache it.

Example

curl -H 'Content-Type: application/x-www-form-urlencoded' \
     -d 'client_id=citrus-test-subscription' \
     -d 'client_secret=824d9fdd75344ef24b3042d05e31a90d' \
     -d 'grant_type=implicit' \
     -X POST 'https://sandboxadmin.citruspay.com/oauth/token'

Response

{
	"access_token": "10a03d9e-24ea-447e-ac8d-c2fa2f97fb69",
	"token_type": "bearer",
	"expires_in": 30067021,
	"scope": "subscription"
}

Do the user binding

This is a webservice call

  • protocol HTTPS
  • hostname admin.citruspay.com (live) or sandboxadmin.citruspay.com (integration)
  • method POST
  • path /service/v2/identity/bind
  • Content-Type application/x-www-form-urlencoded
  • Authorization Bearer
  • parameters
    • email the email of the user to bind
    • mobile the mobile number of the user to bind

It returns an JSON object with username containing the bound user's CitrusPay username.

Example

curl -H 'Content-Type: application/x-www-form-urlencoded' \
     -H 'Authorization: Bearer 10a03d9e-24ea-447e-ac8d-c2fa2f97fb69' \
     -d '[email protected]' \
     -d 'mobile=9876543210' \
     -X POST 'https://sandboxadmin.citruspay.com/service/v2/identity/bind'

Response

{
	"username": "[email protected]"
}

Get a one-time OAuth token for bind user

This is a webservice call

  • protocol HTTPS
  • hostname admin.citruspay.com (live) or sandboxadmin.citruspay.com (integration)
  • method POST
  • path /oauth/token
  • Content-Type application/x-www-form-urlencoded
  • parameters
    • client_id your wallet oauth client id
    • client_secret your wallet oauth client secret
    • grant_type username
    • username the CitrusPay username returned by the user binding

The OAuth subscription token is the access_token attribute of the returned JSON object. This token is short lived, don't cache it.

Example

curl -H 'Content-Type: application/x-www-form-urlencoded' \
     -d 'client_id=citrus-test-userwallet' \
     -d 'client_secret=66683a9c74132fded36f17ae2bb8d4b1' \
     -d 'grant_type=username' \
     -d '[email protected]' \
     -X POST 'https://sandboxadmin.citruspay.com/oauth/token'

Response

{
	"access_token": "2c245c89-fed6-493c-87df-fb109974c517",
	"token_type": "bearer",
	"refresh_token": "cea30584-a600-4d7d-9029-56df35fb93df",
	"expires_in": 79,
	"scope":"merchant_wallet"
}
Clone this wiki locally