Skip to content

WooCommerce Wallet REST API

Subrata Mal edited this page Sep 26, 2018 · 2 revisions

API Authentication

We are using WP REST API Authentication

For WooWallet REST API Authentication Please see https://v2.wp-api.org/guide/authentication/

Get all user wallet transactions by user id

  • https://example.com/wp-json/wp/v2/wallet/{id}

  • Method: GET

  • URL Params

    Replace {id} with respective user id

    Required:

    id=[integer]

  • 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 id

  • https://example.com/wp-json/wp/v2/current_balance/{id}

  • Method: GET

  • URL Params

    Replace {id} with respective user id

    Required:

    id=[integer]

  • 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/wp/v2/wallet/{id}

  • Method: POST

  • URL Params

    Replace {id} with respective user id

    Required:

    id=[integer]

  • Data Params type=[string] tarnsaction type debit or credit amount=[decimal] transaction amount details=[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] => )
Clone this wiki locally
You can’t perform that action at this time.