Buy Account Credits
Uri: https://v2.api.finerworks.com/v3/buy_account_credits
Method: POST
This does not automatically create an account credit in one's account.This adds it to one's shopping cart for later checkout. Only authorized accounts may use this endpoint.
Body
| Name | Description | Type | Additional information |
|---|---|---|---|
| amount |
Min is $100 (USD). Max allowed is $5000 (USD) |
decimal |
Required Range: inclusive between 100 and 5000 |
| cart_id |
Cart to assign the account credit to |
text |
Required |
| extra_credits |
Percentage of extra credits this will be valued at. |
decimal |
None. |
| account_key |
Optional - User account associated with the request. Note, this will only be accepted for accounts with permission to utilize this parameter, otherwise it will be ignored and the request will based upon the user's api credentials. Leave as null if not authorized to use this parameter. |
text |
None. |
Example JSON Body
application/json, text/json
{
"amount": 1.0,
"cart_id": "sample string 2",
"extra_credits": 3.0,
"account_key": "sample string 4"
}
Sample Code Library
curl --location --request sample_method 'https://v2.api.finerworks.comsample_endpoint' \
--header 'Content-Type: application/json' \
--header 'web_api_key: my-web-api-key-goes-here' \
--header 'app_key: my-app-key-goes-here' \
--data-raw '{
"amount": 1.0,
"cart_id": "sample string 2",
"extra_credits": 3.0,
"account_key": "sample string 4"
}'
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://v2.api.finerworks.comsample_endpoint');
$request->setMethod(HTTP_Request2::METHOD_sample_method);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/json',
'web_api_key' => 'my-web-api-key-goes-here',
'app_key' => 'my-app-key-goes-here'
));
$request->setBody('{
'amount': 1.0,
'cart_id': 'sample string 2',
'extra_credits': 3.0,
'account_key': 'sample string 4'
}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
var client = new RestClient("https://v2.api.finerworks.comsample_endpoint");
client.Timeout = -1;
var request = new RestRequest(Method.sample_method);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("web_api_key", "my-web-api-key-goes-here");
request.AddHeader("app_key", "my-app-key-goes-here");
request.AddParameter("application/json", "{
'amount': 1.0,
'cart_id': 'sample string 2',
'extra_credits': 3.0,
'account_key': 'sample string 4'
}, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);
var settings = {
"url": "https://v2.api.finerworks.comsample_endpoint",
"method": "sample_method",
"timeout": 0,
"headers": {
"Content-Type": "application/json",
"web_api_key": "my-web-api-key-goes-here",
"app_key": "my-app-key-goes-here"
},
"data": JSON.stringify({
'amount': 1.0,
'cart_id': 'sample string 2',
'extra_credits': 3.0,
'account_key': 'sample string 4'
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'sample_method',
'hostname': 'v2.api.finerworks.com',
'path': 'sample_endpoint',
'headers': {
'Content-Type': 'application/json',
'web_api_key': 'my-web-api-key-goes-here',
'app_key': 'my-app-key-goes-here'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({
"amount": 1.0,
"cart_id": "sample string 2",
"extra_credits": 3.0,
"account_key": "sample string 4"
});
req.write(postData);
req.end();
require "uri"
require "net/http"
url = URI("https://v2.api.finerworks.comsample_endpoint")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::sample_method.new(url)
request["Content-Type"] = "application/json"
request["web_api_key"] = "my-web-api-key-goes-here"
request["app_key"] = "my-app-key-goes-here"
request.body = "{
'amount': 1.0,
'cart_id': 'sample string 2',
'extra_credits': 3.0,
'account_key': 'sample string 4'
}"
response = https.request(request)
puts response.read_body
| Name | Description | Type | Additional information |
|---|---|---|---|
| product_id | number |
None. |
|
| status | response_status |
None. |
Example JSON Response
application/json, text/json
{
"product_id": 1,
"status": {
"success": true,
"status_code": 100,
"message": "sample string 2",
"debug": {},
"reference_id": "sample string 4",
"domain": "sample string 5"
}
}