Account Management
You or your clients through your interface are able to make changes, update account settings and even credit account balances by utilising to the company
resource.
Crediting Easyship Account Balance
Registered Card
In order to credit your Easyship balance, you need to have a registered credit card added to your account in the Easyship dashboard.
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <YOUR EASYSHIP API TOKEN>" \
--data-binary "{
\"amount\": 1000
}" \
'https://api.easyship.com/company/v1/credits'
var request = require('request');
request({
method: 'POST',
url: 'https://api.easyship.com/company/v1/credits',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer <YOUR EASYSHIP API TOKEN>'
},
body: "{ \"amount\": 1000}"
}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
require 'rubygems' if RUBY_VERSION < '1.9'
require 'rest_client'
values = '{
"amount": 1000
}'
headers = {
:content_type => 'application/json',
:authorization => 'Bearer <YOUR EASYSHIP API TOKEN>'
}
response = RestClient.post 'https://api.easyship.com/company/v1/credits', values, headers
puts response
import requests
url = "https://api.easyship.com/company/v1/credits"
payload = "{\n \"amount\": 1000\n}"
headers = {
'accept': "application/json",
'content-type': "application/json",
'authorization': "Bearer <your access token>",
'cache-control': "no-cache",
'postman-token': "51b550fa-59eb-3901-b2f1-1c2b67eab892"
}
response = requests.request("POST", url, data=payload, headers=headers)
print(response.text)
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.easyship.com/company/v1/credits");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{
\"amount\": 1000
}");
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Content-Type: application/json",
"Authorization: Bearer <YOUR EASYSHIP API TOKEN>"
));
$response = curl_exec($ch);
curl_close($ch);
var_dump($response);
var request = new XMLHttpRequest();
request.open('POST', 'https://api.easyship.com/company/v1/credits');
request.setRequestHeader('Content-Type', 'application/json');
request.setRequestHeader('Authorization', 'Bearer <YOUR EASYSHIP API TOKEN>');
request.onreadystatechange = function () {
if (this.readyState === 4) {
console.log('Status:', this.status);
console.log('Headers:', this.getAllResponseHeaders());
console.log('Body:', this.responseText);
}
};
var body = {
'amount': 1000
};
request.send(JSON.stringify(body));
{
"amount": 1000
}
Updated about 7 years ago