NAV

Introduction

Gluwa API is a simple and powerful REST API to integrate Gluwa into your business or applications.

This API reference provides information on available endpoints and how to interact with it.

API 2.0 and below no longer supported.

API Endpoint

https://api.gluwa.com/v3/

Authentication

User can authenticate via token or password depending on the type of request. In general, read requests are done by token authentication, but create or update requests are done with password authentication.

Token

Token is a hash string used in HTTP Header to authorize user of the request.

For clients to authenticate, the token key should be included in the Authorization HTTP header. The key should be prefixed by the string literal “Bearer”, with whitespace separating the two strings. For example:

Authorization: Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b

Unauthenticated responses that are denied permission will result in an HTTP 401 Unauthorized response with an appropriate WWW-Authenticate header.

Token resource

Request Token of a Gluwa user account by submitting username, password and optional remember_me. If you set true for remember_me, you get refresh_token. Else, you will get an empty string for the refresh_token

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/token/'

data = {
    'username': 'johndoe',
    'password': 'f1o2s3e4j5a',
    'remember_me': True
}

response = requests.post(url=url, data=data)
curl -H "Content-Type: application/json" \
-X POST \
-d '{"username":"johndoe", "password": "f1o2s3e4j5a", "remember_me": true}' \
https://api.gluwa.com/v3/token/

Example response (200)

{
  "user_id": "4321",
  "token": "2rsrLo0G15S2DJ0AKfOD0uz7xdPO5D",
  "refresh_token": "EoyWjzHwRRTRLdX58WnWBN6wNIlbNn",
  "expired_by": "2017-05-25T09:12:47.909040Z",
  "is_phone_number_verified": true,
  "funding_source_status": "Active",
  "cip_status": "Verified",
  "currency": "USD"
}

HTTP Request

POST https://api.gluwa.com/v3/token/

Arguments

Parameter Type Required Description
username string Required The username of a Gluwa account.
password string Required The password of a Gluwa account.
remember_me bool Optional Whether or not to receive refresh_token.

HTTP Code

Case Code
success 200

User Registration

Create a User to Gluwa by submitting username, email and password. Needless to say, that username and email have to be unique.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/user/create/'

data = {
    'username': 'johndoe',
    'email': 'johndoe@email.com',
    'password': 'f1o2s3e4j5a'
}

response = requests.post(url=url, data=data)
curl -H "Content-Type: application/json" \
-X POST \
-d '{"username":"johndoe", "email":"johndoe@email.com", "password": "f1o2s3e4j5a"}' \
https://api.gluwa.com/v3/user/create/

Example response (201)

{
  "username": "johndoe",
  "email": "johndoe@email.com"
}

HTTP Request

POST https://api.gluwa.com/v3/user/create/

Arguments

Parameter Type Required Description
username string Required username for a Gluwa account. Must be unique.
email string Required email for a Gluwa account. Must be unique.
password string Required password for a Gluwa account.

HTTP Code

Case Code
success 201

Password reset

Request password reset email by submitting an email attached to your Gluwa account. You will get a one-time link to a password reset page to submitted email.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/user/password/reset/'

data = {
    'email': 'johndoe@email.com'
}

response = requests.post(url=url, data=data)
curl -H "Content-Type: application/json" \
-X POST \
-d '{"email":"johndoe@email.com"}' \
https://api.gluwa.com/v3/user/password/reset/

Example response (200)


{
    "email": "johndoe@email.com"
}

HTTP Request

POST https://api.gluwa.com/v3/user/password/reset/

Arguments

Parameter Type Required Description
email string Required Email address attached to a Gluwa account.

HTTP Code

Case Code
success 200

Scopes

Both API key and OAuth2 authentication require that you obtain correct permissions (scopes) to access different API endpoints.

All authenticated endpoints, except GET /user, require a specific scope to access them. Some endpoints might also have additional scopes for additional information or access. In general, permissions follow the service-name:resource:action pattern.

With OAuth2, scopes should be considered as grants: Users can select which scopes they grant access to for the application. The application might need to request new scopes over the lifecycle of the authorization. To see which permissions the user has granted, you can use GET /user/auth endpoint.

As a general rule, you should only ask for scopes which your application needs and avoid asking for access to unnecessary ones. Users more readily grant access to limited, clearly described scopes.

Account Endpoints

Accounts

Account resource represents Gluwa wallet. Gluwa wallet contains Gluwa Coin, which is a Bitcoin backed by fiat currency.

User Account resource

Each Gluwa users have a Gluwa account.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/account/user/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

response = requests.get(url=url, headers=headers)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
https://api.gluwa.com/v3/account/user/

Example response : USD (200)

{
  "id": "159a447c-be79-48de-9395-0f6f6bdaecc5",
  "balance": "1234567.00",
  "btc_balance": "1.23456789",
  "currency": "USD"
}

Example response : KRW (200)

{
  "id": "159a447c-be79-48de-9395-0f6f6bdaecc5",
  "balance": "1234567.00",
  "btc_balance": "1.23456789",
  "virtual_account": [
    {
      "VirtualAccountNumber": "12345678901234",
      "BankName": "신한은행"
    }
  ],
  "currency": "KRW"
}

HTTP Request

GET https://api.gluwa.com/v3/account/user/

Scopes

bank:account:read

Arguments

None

HTTP Code

Case Code
success 200

Account Phone Number Confirmation Create

In order to use Gluwa account you need to verify a unique phone number. Create a phone number confirmation code at this endpoint.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/account/phone/confirmation/create/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'phone_number': '1239991234',
    'country_code': '1'
}

response = requests.post(url=url, headers=headers, data=data)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
-H "Content-Type: application/json" \
-X POST \
-d '{"phonenumber": "1239991234", "country_code": "1"}' \
https://api.gluwa.com/v3/account/phone/confirmation/create/

Example response (200)


{
    "phone_number": "1239991234",
    "country_code": "1"
}

HTTP Request

POST https://api.gluwa.com/v3/account/phone/confirmation/create/

Scopes

bank:account:phone

Arguments

Parameter Type Required Description
phone_number string Required A unique phone number for a Gluwa account.
phone_country_code string Required ISD country calling codes or country dial in codes.

HTTP Code

Case Code
success 201

Account Phone Number Confirmation Verify

In order to use Gluwa account you need to verify a unique phone number. Request a confirmation code from Account Phone Number Confirmation Create

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/account/phone/confirmation/verify/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'phone_number': '1239991234',
    'country_code': '1',
    'code': '123456'
}

response = requests.post(url=url, headers=headers, data=data)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
-H "Content-Type: application/json" \
-X POST \
-d '{"phone_number": "1239991234", "country_code": "1", "code": "123456"}' \
https://api.gluwa.com/v3/account/phone/confirmation/verify/

Example response (200)


{
    "phone_number": "1239991234",
    "country_code": "1",
    "code": "123456"
}

HTTP Request

POST https://api.gluwa.com/v3/account/phone/confirmation/verify/

Scopes

bank:account:phone

Arguments

Parameter Type Required Description
phone_number string Required A unique phone number for a Gluwa account.
phone_country_code string Required ISD country calling codes or country dial in codes.
code string Required Phone number confirmation code.

HTTP Code

Case Code
accepted 202

Transaction Endpoints

Transaction resource

Transaction resource represents an event on the account. It can be either negative or positive on amount depending if it credited or debited funds on the account. If there’s more than one party, the transaction will have to field.

Transaction types currently available:

  • buy : Buy transactions.
  • sen : Send transactions
  • sel : Sell transactions.

Transactions statuses vary based on the type of the transaction. As both types and statuses can change over time, we recommend that you use details field for constructing human readable descriptions of transactions. Currently available statuses are:

  • p : Pending transactions.
  • c : Completed transactions
  • f : Failed transactions.
Fields Type Description
id string, uuid Resource Id
account_id string, uuid The originating party of a credit transaction.
type string Transaction type
amount integer Amount of transaction
fee integer Fee amount of transaction
currency string Currency of transaction
to string, uuid The receiving party of a debit transaction.
status string Status of transaction
description string Description of transaction. Optional.
created timestamp
modified timestamp

Show a transaction

Show an individual transaction for an account. See transaction resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

id = '6fddf318-95d4-4d88-8c1e-0ad614a3577b'
url = 'https://api.gluwa.com/v3/transaction/%s/' % id

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

response = requests.get(url=url, headers=headers)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
-X GET \
https://api.gluwa.com/v3/transaction/6fddf318-95d4-4d88-8c1e-0ad614a3577b/

Example response : Buy transaction (200)

{
  "id": "6ed2f219-b73e-584f-990a-35dd4ccaffdf",
  "account_id": "7a7bcece-bce1-5710-9f7d-a08dd916cc1d",
  "type": "buy",
  "status": "c",
  "amount": 1234,
  "fee": 50,
  "currency": "usd",
  "description": "lorem ipsum",
  "created": "2017-05-23T18:10:36.820230Z",
  "modified": "2017-05-23T18:10:42.949830Z"
}

Example response : Sell transaction (200)

{
  "id": "6ed2f219-b73e-584f-990a-35dd4ccaffdf",
  "account_id": "7a7bcece-bce1-5710-9f7d-a08dd916cc1d",
  "type": "sel",
  "status": "c",
  "amount": 1234,
  "fee": 50,
  "currency": "usd",
  "description": "lorem ipsum",
  "created": "2017-05-23T18:10:36.820230Z",
  "modified": "2017-05-23T18:10:42.949830Z"
}

Example response : Send transaction (200)

{
  "id": "6ed2f219-b73e-584f-990a-35dd4ccaffdf",
  "account_id": "7a7bcece-bce1-5710-9f7d-a08dd916cc1d",
  "to": "49d416eb-b0b7-554c-8a5b-613d12537943",
  "type": "sel",
  "status": "c",
  "amount": 1234,
  "fee": 50,
  "currency": "usd",
  "description": "lorem ipsum",
  "created": "2017-05-23T18:10:36.820230Z",
  "modified": "2017-05-23T18:10:42.949830Z"
}

HTTP Request

GET https://api.gluwa.com/v3/transaction/<transaction id>/

Scopes

bank:transaction:read

HTTP Code

Case Code
success 200

Transaction list resource

Transaction list resource represents a simplified information of an event on the account.

Transaction list types currently available:

  • buy : Buy transactions.
  • sen : Send transactions
  • sel : Sell transactions.
  • rec : Receive transactions.

Transactions statuses vary based on the type of the transaction. As both types and statuses can change over time, we recommend that you use details field for constructing human readable descriptions of transactions. Currently available statuses are:

  • p : Pending transactions.
  • c : Completed transactions
  • f : Failed transactions.
Fields Type Description
id string, uuid Resource Id
account_id string, uuid The originating party of a credit transaction.
type string Transaction type
amount integer Amount of transaction
fee integer Fee amount of transaction
currency string Currency of transaction
status string Status of transaction
description string Description of transaction. Optional.
created timestamp
modified timestamp

List transaction

List user’s transctions in reverse order of created time. User is identified by Authentication Token. Add id of the last transaction as GET parameter last_id to receive transactions earlier than that.

See transaction list resource for more information.

Extend URL to filter for type of transaction:

  • buy : buy transaction list only.
  • sel : sell transaction list only.
  • sen : send transaction list only.
  • rec : receive transaction list only.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/transaction/list/usd/?last_id=a64bc40a-fdb2-409d-1237-a779bdf06467'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

response = requests.get(url=url, headers=headers)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
-X GET \
https://api.gluwa.com/v3/transaction/list/usd/?last_id=a64bc40a-fdb2-409d-1237-a779bdf06467

Example response (200)

{
    "results":[
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"sen",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"buy",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"sel",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"sen",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"buy",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id":"6b992bdf-5085-4b52-9033-3584fb15c732",
            "account_id":"6a44457c-112a-4d8e-9953-a5cf6c0f6abe",
            "type":"sel",
            "amount":1234,
            "fee":50,
            "currency":"usd",
            "status":"c",
            "idem":"2c8a5775-4249-49a9-864d-5160634692bd",
            "description":"",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        }
    ]
}

HTTP Request

For USD

  • all types of transaction : GET https://api.gluwa.com/v3/transaction/list/usd/
  • buy transactions only : GET https://api.gluwa.com/v3/transaction/list/usd/buy/
  • sell transactions only : GET https://api.gluwa.com/v3/transaction/list/usd/sel/
  • send transactions only : GET https://api.gluwa.com/v3/transaction/list/usd/sen/
  • receive transactions only : GET https://api.gluwa.com/v3/transaction/list/usd/rec/

For KRW

  • all types of transaction : GET https://api.gluwa.com/v3/transaction/list/krw/
  • buy transactions only : GET https://api.gluwa.com/v3/transaction/list/krw/buy/
  • sell transactions only : GET https://api.gluwa.com/v3/transaction/list/krw/sel/
  • send transactions only : GET https://api.gluwa.com/v3/transaction/list/krw/sen/
  • receive transactions only : GET https://api.gluwa.com/v3/transaction/list/krw/rec/

Scopes

bank:transaction:read

HTTP Code

Case Code
success 200

Transaction Send : to User

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/transaction/send/user/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'password': 'f1o2s3e4j5a',
    'sendToUsername': 'janedoe',
    'amount': '1234.56',
    'currency': 'usd',
    'message': 'lorem ipsum'
}

response = requests.post(url=url, headers=headers, data=data)
curl -H "Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf" \
-H "Content-Type: application/json" \
-X POST \
-d '{"password": "f1o2s3e4j5a", "sendToUsername": "janedoe", "amount": "1234.56", "currency": "usd", "message": "lorem ipsum"}'
https://api.gluwa.com/v3/transaction/send/user/

Send funds from a Gluwa user account to another Gluwa user account.

Example response (201)

{
  "transaction_id": "9bd3d727-3bb8-490d-83d0-19e640596ff9"
}

HTTP Request

POST https://api.gluwa.com/v3/transaction/send/user/

Scopes

bank:transaction:send

Arguments

Parameter Type Required Description
password string Required Password of Gluwa User of sender account.
sendToUsername string Required Receiver’s Gluwa username.
amount decimal Required Amount to be sent.
currency string Required Currency of transaction.
to_message_id string Optional Description of transaction.

HTTP Code

Case Code
success 201

Transaction Sell

Sell funds from a Gluwa account for fiat currency, and deposit to the user’s bank account.

HTTP Request

POST https://api.gluwa.com/v3/transaction/sell/

Scopes

bank:transaction:sell

Arguments

Parameter Type Required Description
password string Required Password of Gluwa User of sender account.
amount decimal Required Amount to be sent.
currency string Required Currency of transaction.

HTTP Code

Case Code
success 201

Example request

import requests

url = 'https://api.gluwa.com/v3/transaction/sell/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'password': 'f1o2s3e4j5a',
    'amount': '1234.56',
    'currency': 'usd'
}

response = requests.post(url=url, headers=headers, data=data)
curl -H "Content-Type: application/json"
-H 'Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
-X POST
-d '{"password": "f1o2s3e4j5a", "amount": "1234.56", "currency": "usd"}'
https://api.gluwa.com/v3/transaction/sell/

Example response (201)

{
  "transaction_id": "9bd3d727-3bb8-490d-83d0-19e640596ff9"
}

Contract Endpoints

Contracts

Contract resource

Generic Gluwa Pay contract information.

Fields Type Description
id string, uuid Resource Id
account_id string, uuid The owner of this contract
rate string, decimal Payment processing fee rate
authorization_notification_url url URL to receive notification when payment is created
fulfillment_notification_url url URL to receive notification when payment is fulfilled
is_active boolean

Show a contract

Show a contract assigned to the user. See contract resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/contract/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

response = requests.get(url=url, headers=headers)
curl https://api.gluwa.com/v3/contract/ \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf' \
-X GET

Example response (200)

{
    "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "account_id": "a64bc40a-fdb2-409d-1237-a779bdf06467",
    "rate": "0.010",
    "authorization_notification_url": "https://www.example.com/",
    "fulfillment_notification_url": "https://www.example.com/",
    "is_active": true
}

HTTP Request

GET https://api.gluwa.com/v3/contract/

Scopes

pay:contract:read

HTTP Code

Case Code
success 200

Update authorization notification url for a contract

You can set a authorization notification URL for your contract to receive callback when payment is created.

Notification URL will get payment_id and extra_data as JSON.

See contract resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/contract/update/a64bc40a-fdb2-409d-1237-a779bdf06467/authorization/notification'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'authorization_notification_url': 'https://www.example.com/'
}

response = requests.put(url=url, headers=headers, data=data)
curl https://api.gluwa.com/v3/contract/update/a64bc40a-fdb2-409d-1237-a779bdf06467/authorization/notification/ \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' \
-X PUT \
-d '{"authorization_notification_url": "https://www.example.com/"}

Example response (200)

{
    "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "authorization_notification_url": "https://www.example.com/"
}

Example notification

{
    "payment_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "extra_data": "order information"
}

HTTP Request

PUT https://api.gluwa.com/v3/contract/update/<contract_id>/authorization/notification

Scopes

pay:contract:update

HTTP Code

Case Code
success 200

Update fulfillment notification url for a contract

You can set a fulfillment notification URL for your contract to receive callback when payment is fulfilled.

Notification URL will get payment_id and extra_data as JSON.

See contract resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/contract/update/a64bc40a-fdb2-409d-1237-a779bdf06467/fulfillment/notification/'

headers = {
    'Authorization': 'Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf'
}

data = {
    'fulfillment_notification_url': 'https://www.example.com/'
}

response = requests.put(url=url, headers=headers, data=data)
curl https://api.gluwa.com/v3/contract/update/a64bc40a-fdb2-409d-1237-a779bdf06467/fulfillment/notification/ \
-H "Content-Type: application/json" \
-H 'Authorization: Bearer 40Xp6pzfU7nQwCZo9gZjfm88o6jfqf' \
-X PUT \
-d '{"fulfillment_notification_url": "https://www.example.com/"}

Example response (200)

{
    "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "fulfillment_notification_url": "https://www.example.com/"
}

Example notification

{
    "payment_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "amount": 12345,
    "extra_data": "order information"
}

HTTP Request

PUT https://api.gluwa.com/v3/contract/update/<contract_id>/fulfillment/notification/

Scopes

pay:contract:update

HTTP Code

Case Code
success 200

Payment Escrow Endpoints

Payment Escrows

Payment Escrow resource

You can create a payment escrow for your contract to other Gluwa user. Read here{:target=“_blank”} for more information about the concept of escrow.

Fields Type Description
id string, uuid Resource Id
contract_id string, uuid Contract requesting payment
account_id string, uuid Account receiving the payment request
extra_data string Extra data
amount string, stringified decimal Amount of payment
authorized boolean If payment is authorized
fulfilled boolean If payment is fulfilled
created timestamp

Create payment escrow

You can create a payment escrow for your contract to other Gluwa user. Owner of requested account will get authorization code to their phone number. The user can use the code to authorize payment and send payment on hold to Gluwa.

See payment escrow resource for more information.

Create payment escrow via username

You can specify an account paying for a payment escrow with username.

See create payment escrow for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/payments/escrow'

data = {
    'contract_id': '104c8039-8d1e-4929-bc03-8a9eb17fa2e6',
    'username': 'johndoe',
    'extra_data': 'order information',
    'amount': '10.00',
    'currency': 'usd'
}

response = requests.post(url=url, headers=headers, data=data)
curl https://api.gluwa.com/v3/payments/escrow \
-X POST \
-d '{"contract_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6","username": "johndoe","extra_data": "order information", "amount": "10.00", "currency": "usd"}'

Example response (200)

{
    "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "contract_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "account_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "extra_data": "extra data",
    "amount": "10.00",
    "currency": "usd",
    "created": "2017-02-28T01:21:15.388980Z"
}

HTTP Request

POST https://api.gluwa.com/v3/payments/escrow

Scopes

pay:request:create

HTTP Code

Case Code
success 201

Payment Escrow Authorizations

Payment Escrow Authorization resource

Generic payment escrow authorization information.

Fields Type Description
key string Confirmation code used to verify payment is authorized
escrow_id string, uuid ID of payment escrow

Authorize payment escrow

You can authorize payment escrow with confirmation code sent to your phone number.

See payment escrow authorization resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/payments/escrow/104c8039-8d1e-4929-bc03-8a9eb17fa2e6/authorization'

data = {
    'key': '123456'
}

response = requests.put(url=url, headers=headers, data=data)
curl https://api.gluwa.com/v3/payments/escrow/104c8039-8d1e-4929-bc03-8a9eb17fa2e6/authorization
-X PUT
-d '{"key":"123456"}'

Example response (200)

{
    "key": "123456",
    "escrow_id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6"
}

HTTP Request

PUT https://api.gluwa.com/v3/payments/escrow/<escrow_id>/authorization

Scopes

pay:request:update

HTTP Code

Case Code
success 200

Payment Escrow Fulfillments

Payment Escrow Fulfillment resource

Generic payment escrow fulfillment information.

Fields Type Description
key string Confirmation code used to verify payment is fulfilled

Fullfill payment escrow

You can fulfill payment escrow with confirmation code sent to your phone number.

See payment escrow fulfillment resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/payments/escrow/<escrow_id>/fulfillment'

data = {
    'key': '123456'
}

response = requests.put(url=url, headers=headers, data=data)
curl https://api.gluwa.com/v3/payments/escrow/104c8039-8d1e-4929-bc03-8a9eb17fa2e6/fulfillment \
-X PUT \
-d '{"key":"123456","escrow_id":"104c8039-8d1e-4929-bc03-8a9eb17fa2e6"}'

Example response (200)

{
    "key": "123456"
}

HTTP Request

PUT https://api.gluwa.com/v3/payments/escrow/104c8039-8d1e-4929-bc03-8a9eb17fa2e6/fulfillment

Scopes

pay:request:update

HTTP Code

Case Code
success 200

Payment Endpoints

Payment

Payment resource

Payment made from Account to Contract.

Payment status vary based on the type of the transaction. As both types and statuses can change over time, we recommend that you use details field for constructing human readable descriptions of payment. Currently available statuses are:

  • p : Pending payments.
  • c : Completed payments
  • f : Failed payments.
Fields Type Description
id string, uuid Resource Id
contract_id string, uuid Contract receiving payment
extra_data string Extra data
amount integer Amount of payment
status string
created timestamp
modified timestamp

List payments

List contract’s payments in reverse order of created time. Add id of the last payment as GET parameter last_id to receive payments earlier than that.

See payment resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/payment/list/contract/a64bc40a-fdb2-409d-1237-a779bdf06467/'

headers = {
    'Authorization': 'Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
}

response = requests.get(url=url, headers=headers)
curl https://api.gluwa.com/v3/payment/list/contract/a64bc40a-fdb2-409d-1237-a779bdf06467/
-H "Content-Type: application/json"
-H 'Authorization: Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
-X GET

Example response (200)

{
    "results": [
        {
            "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
            "contract_id": "a64bc40a-fdb2-409d-1237-a779bdf06467",
            "extra_data": "extra data",
            "amount": "1000",
            "status": "c",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
            "contract_id": "a64bc40a-fdb2-409d-1237-a779bdf06467",
            "extra_data": "extra data",
            "amount": "1000",
            "status": "c",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        },
        {
            "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
            "contract_id": "a64bc40a-fdb2-409d-1237-a779bdf06467",
            "extra_data": "extra data",
            "amount": "1000",
            "status": "c",
            "created":"2016-07-27T21:20:27.313470Z",
            "modified":"2016-07-27T21:20:46.798050Z"
        }
    ]
}

HTTP Request

  • payment list of an contract : GET https://api.gluwa.com/v3/payment/list/contract/<contract_id>/

Scopes

pay:payment:read

HTTP Code

Case Code
success 200

Show a payment

Show an individual payment. See payment resource for more information.

Example request

# Install python-requests by:
# pip install requests
import requests

url = 'https://api.gluwa.com/v3/payment/a64bc40a-fdb2-409d-1237-a779bdf06467/'

headers = {
    'Authorization': 'Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
}

response = requests.get(url=url, headers=headers)
curl https://api.gluwa.com/v3/payment/a64bc40a-fdb2-409d-1237-a779bdf06467/
-H "Content-Type: application/json"
-H 'Authorization: Bearer 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
-X GET

Example response (200)

{
    "id": "104c8039-8d1e-4929-bc03-8a9eb17fa2e6",
    "contract_id": "a64bc40a-fdb2-409d-1237-a779bdf06467",
    "extra_data": "extra data",
    "amount": "1000",
    "status": "c",
    "created":"2016-07-27T21:20:27.313470Z",
    "modified":"2016-07-27T21:20:46.798050Z"
}

HTTP Request

GET https://api.gluwa.com/v3/payment/<payment_id>/

Scopes

pay:payment:read

HTTP Code

Case Code
success 200

Errors

The Gluwa API uses the following error codes:

Error Code Meaning
400 Bad Request – Your request is unacceptable
401 Unauthorized – Your API Token or password is invalid
403 Forbidden – Requested data is inaccessible to you
404 Not Found – Requested data does not exist
405 Method Not Allowed – You tried to access API with an invalid method
406 Not Acceptable – You requested a format that isn’t json
429 Too Many Requests – You’re requesting too frequently.
500 Internal Server Error – We had a problem with our server. Try again later.
503 Service Unavailable – We’re temporarially offline for maintanance. Please try again later.