Add funds through credit card
curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/funds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currencyisocode": "USD",
"fund_amount_in_cents": 25000,
"id": "clientProvidedId_abc123"
}
'import requests
url = "https://api-testbed.giftbit.com/papi/v1/funds"
payload = {
"currencyisocode": "USD",
"fund_amount_in_cents": 25000,
"id": "clientProvidedId_abc123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currencyisocode: 'USD',
fund_amount_in_cents: 25000,
id: 'clientProvidedId_abc123'
})
};
fetch('https://api-testbed.giftbit.com/papi/v1/funds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-testbed.giftbit.com/papi/v1/funds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currencyisocode' => 'USD',
'fund_amount_in_cents' => 25000,
'id' => 'clientProvidedId_abc123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-testbed.giftbit.com/papi/v1/funds"
payload := strings.NewReader("{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-testbed.giftbit.com/papi/v1/funds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-testbed.giftbit.com/papi/v1/funds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"info": {
"code": "INFO_FUNDS_ADDED",
"name": "Funds updated",
"message": "Your funds have been updated."
},
"fundsbycurrency": {
"USD": {
"available_in_cents": 196525,
"pending_in_cents": 0,
"reserved_in_cents": 41500
},
"CAD": {
"available_in_cents": 6600,
"pending_in_cents": 0,
"reserved_in_cents": 1000
},
"PRO": {
"available_in_cents": 0,
"pending_in_cents": 0,
"reserved_in_cents": 0
}
}
}{
"error": {
"code": "ERROR_FUNDS_INVALID_FUND_AMOUNT",
"name": "Invalid fund amount.",
"message": "10000 is an invalid fund amount. Minimum in cents: 25000, Maximum in cents: 1000000"
},
"status": 400
}{
"error": {
"code": "ERROR_FUNDS_CARD_ERROR",
"name": "Credit card transaction failed",
"message": "Transaction failed. We were unable to charge your card. Go to web app to update your credit card."
},
"status": 402
}Add funds through credit card
Tops up your account balance with a credit card payment. Use the web interface to place a credit card on file for each currency you plan to fund. The success response provides your updated account balance.
POST
/
funds
Add funds through credit card
curl --request POST \
--url https://api-testbed.giftbit.com/papi/v1/funds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"currencyisocode": "USD",
"fund_amount_in_cents": 25000,
"id": "clientProvidedId_abc123"
}
'import requests
url = "https://api-testbed.giftbit.com/papi/v1/funds"
payload = {
"currencyisocode": "USD",
"fund_amount_in_cents": 25000,
"id": "clientProvidedId_abc123"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
currencyisocode: 'USD',
fund_amount_in_cents: 25000,
id: 'clientProvidedId_abc123'
})
};
fetch('https://api-testbed.giftbit.com/papi/v1/funds', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-testbed.giftbit.com/papi/v1/funds",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'currencyisocode' => 'USD',
'fund_amount_in_cents' => 25000,
'id' => 'clientProvidedId_abc123'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api-testbed.giftbit.com/papi/v1/funds"
payload := strings.NewReader("{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api-testbed.giftbit.com/papi/v1/funds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-testbed.giftbit.com/papi/v1/funds")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"currencyisocode\": \"USD\",\n \"fund_amount_in_cents\": 25000,\n \"id\": \"clientProvidedId_abc123\"\n}"
response = http.request(request)
puts response.read_body{
"info": {
"code": "INFO_FUNDS_ADDED",
"name": "Funds updated",
"message": "Your funds have been updated."
},
"fundsbycurrency": {
"USD": {
"available_in_cents": 196525,
"pending_in_cents": 0,
"reserved_in_cents": 41500
},
"CAD": {
"available_in_cents": 6600,
"pending_in_cents": 0,
"reserved_in_cents": 1000
},
"PRO": {
"available_in_cents": 0,
"pending_in_cents": 0,
"reserved_in_cents": 0
}
}
}{
"error": {
"code": "ERROR_FUNDS_INVALID_FUND_AMOUNT",
"name": "Invalid fund amount.",
"message": "10000 is an invalid fund amount. Minimum in cents: 25000, Maximum in cents: 1000000"
},
"status": 400
}{
"error": {
"code": "ERROR_FUNDS_CARD_ERROR",
"name": "Credit card transaction failed",
"message": "Transaction failed. We were unable to charge your card. Go to web app to update your credit card."
},
"status": 402
}Authorizations
Send your API token prefixed by Bearer in the Authorization header.
Body
application/json