Skip to content

Commit

Permalink
Supporting custom headers
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Jul 3, 2020
1 parent b86fd41 commit 63dafe3
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 59 deletions.
12 changes: 10 additions & 2 deletions examples/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let apiKey = process.env.TONICPOW_API_KEY || ''
// Example: Update a user
//
user.first_name = 'Jack'
user.payout_address = 'mrz@moneybutton.com'
// user.payout_address = 'mrz@moneybutton.com'
user = await TonicPow.updateUser(user)
console.log(user.first_name)

Expand Down Expand Up @@ -405,11 +405,19 @@ let apiKey = process.env.TONICPOW_API_KEY || ''
conversion = await TonicPow.cancelConversion(conversion.id, 'not needed anymore')
console.log('conversion status', conversion.status)

//
// Example: Set a custom header
//
TonicPow.session.customHeaders = {
"x-custom-header": "custom-value",
"x-another-custom-header": "another-value",
}

//
// Example: Get a current rate
//
let rate = await TonicPow.getCurrentRate('usd',0.00)
console.log('rate found ', rate.currency_name, 'price in satoshis', rate.price_in_satoshis)
console.log('price in satoshis', rate.price_in_satoshis)

//
// Example: Logout user
Expand Down
Loading

0 comments on commit 63dafe3

Please sign in to comment.