Skip to content
Subrata Mal edited this page Apr 18, 2023 · 4 revisions

API Authentication

We are using WC REST API Authentication

For TeraWallet REST API Authentication Please see https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication

Get all user wallet transactions by user id

  • https://example.com/wp-json/wc/v3/wallet/

  • Method: GET

  • Data Params email=[email]* user email per_page=[integer] transaction per page page=[integer] current page

  • Success Response:

    • Code: 200
      Content: Array ( [0] => stdClass Object ( [transaction_id] => 74 [user_id] => 1 [date] => 2018-04-16 17:04:52 [type] => credit [amount] => 3.60 [balance] => 289.20 [details] => Wallet credit through cashback #16-111-04 [currency] => DKK [blog_id] => 1 )

      [1] => stdClass Object ( [transaction_id] => 73 [user_id] => 1 [date] => 2018-04-16 17:04:51 [type] => debit [amount] => 18.00 [balance] => 285.60 [details] => For order payment Subrata #16-111-04 [currency] => DKK [blog_id] => 1 ) )

  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: stdClass Object( [code] => rest_forbidden [message] => Sorry, you are not allowed to do that. [data] => stdClass Object ( [status] => 401 ) )

    OR

    • Code: invalid_username
      Content: stdClass Object ( [code] => invalid_username [message] => ERROR: Invalid username. Lost your password? [data] => )

Get user wallet balance by user email

  • https://example.com/wp-json/wc/v3/wallet/balance/

  • Method: GET

  • Data Params email=[email]* user email

  • Success Response:

    • Code: 200
      Content: BALANCE
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: stdClass Object( [code] => rest_forbidden [message] => Sorry, you are not allowed to do that. [data] => stdClass Object ( [status] => 401 ) )

    OR

    • Code: invalid_username
      Content: stdClass Object ( [code] => invalid_username [message] => ERROR: Invalid username. Lost your password? [data] => )

Insert new transaction

  • https://example.com/wp-json/wc/v3/wallet/

  • Method: POST

  • Data Params email=[email]* user email type=[string]* tarnsaction type debit or credit amount=[decimal]* transaction amount note=[string] optional transaction description

  • Success Response:

    • Code: 200
      Content: TRANSACTION ID
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: stdClass Object( [code] => rest_forbidden [message] => Sorry, you are not allowed to do that. [data] => stdClass Object ( [status] => 401 ) )

    OR

    • Code: invalid_username
      Content: stdClass Object ( [code] => invalid_username [message] => ERROR: Invalid username. Lost your password? [data] => )