Create an order
curl --request POST \
--url https://app.agscard.com/api/partner/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_plan_id": 123,
"shipping_method_id": 123,
"items": [
{
"card_product_id": 123,
"quantity": 50,
"declared_value_per_unit": 1
}
],
"upcharges": [
"<string>"
],
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
},
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
}
}
'import requests
url = "https://app.agscard.com/api/partner/v1/orders"
payload = {
"payment_plan_id": 123,
"shipping_method_id": 123,
"items": [
{
"card_product_id": 123,
"quantity": 50,
"declared_value_per_unit": 1
}
],
"upcharges": ["<string>"],
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
},
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
}
}
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({
payment_plan_id: 123,
shipping_method_id: 123,
items: [{card_product_id: 123, quantity: 50, declared_value_per_unit: 1}],
upcharges: ['<string>'],
shipping_address: {
first_name: '<string>',
last_name: '<string>',
address: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
phone: '<string>',
country_code: '<string>'
},
billing_address: {
first_name: '<string>',
last_name: '<string>',
address: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
phone: '<string>',
country_code: '<string>'
}
})
};
fetch('https://app.agscard.com/api/partner/v1/orders', 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://app.agscard.com/api/partner/v1/orders",
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([
'payment_plan_id' => 123,
'shipping_method_id' => 123,
'items' => [
[
'card_product_id' => 123,
'quantity' => 50,
'declared_value_per_unit' => 1
]
],
'upcharges' => [
'<string>'
],
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'address' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'phone' => '<string>',
'country_code' => '<string>'
],
'billing_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'address' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'phone' => '<string>',
'country_code' => '<string>'
]
]),
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://app.agscard.com/api/partner/v1/orders"
payload := strings.NewReader("{\n \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\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://app.agscard.com/api/partner/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.agscard.com/api/partner/v1/orders")
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 \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"order_number": "<string>",
"status": "<string>",
"payment_status": "<string>",
"payment_url": "<string>",
"payment_plan_id": 123,
"price_per_card": 123,
"turnaround": "<string>",
"shipping_method": {
"id": 123,
"code": "<string>",
"name": "<string>"
},
"number_of_cards": 123,
"upcharges": [
{
"code": "<string>",
"amount": 123
}
],
"service_fee": 123,
"shipping_fee": 123,
"upcharges_fee": 123,
"discounted_amount": 123,
"grand_total": 123,
"created_at": "<string>",
"items": [
{
"id": 123,
"card_product_id": 123,
"card_name": "<string>",
"declared_value": 123
}
]
}
}{
"data": {
"id": 123,
"order_number": "<string>",
"status": "<string>",
"payment_status": "<string>",
"payment_url": "<string>",
"payment_plan_id": 123,
"price_per_card": 123,
"turnaround": "<string>",
"shipping_method": {
"id": 123,
"code": "<string>",
"name": "<string>"
},
"number_of_cards": 123,
"upcharges": [
{
"code": "<string>",
"amount": 123
}
],
"service_fee": 123,
"shipping_fee": 123,
"upcharges_fee": 123,
"discounted_amount": 123,
"grand_total": 123,
"created_at": "<string>",
"items": [
{
"id": 123,
"card_product_id": 123,
"card_name": "<string>",
"declared_value": 123
}
]
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>"
}
}{
"error": {
"code": "idempotency_key_in_use",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>",
"errors": {}
}
}Orders
Create an order
Creates a pending order for the customer, who pays for it in our app through the returned payment_url. A replayed Idempotency-Key returns the original order with a 200 and the Idempotent-Replayed header.
POST
/
orders
Create an order
curl --request POST \
--url https://app.agscard.com/api/partner/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payment_plan_id": 123,
"shipping_method_id": 123,
"items": [
{
"card_product_id": 123,
"quantity": 50,
"declared_value_per_unit": 1
}
],
"upcharges": [
"<string>"
],
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
},
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
}
}
'import requests
url = "https://app.agscard.com/api/partner/v1/orders"
payload = {
"payment_plan_id": 123,
"shipping_method_id": 123,
"items": [
{
"card_product_id": 123,
"quantity": 50,
"declared_value_per_unit": 1
}
],
"upcharges": ["<string>"],
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
},
"billing_address": {
"first_name": "<string>",
"last_name": "<string>",
"address": "<string>",
"address_2": "<string>",
"city": "<string>",
"state": "<string>",
"zip": "<string>",
"phone": "<string>",
"country_code": "<string>"
}
}
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({
payment_plan_id: 123,
shipping_method_id: 123,
items: [{card_product_id: 123, quantity: 50, declared_value_per_unit: 1}],
upcharges: ['<string>'],
shipping_address: {
first_name: '<string>',
last_name: '<string>',
address: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
phone: '<string>',
country_code: '<string>'
},
billing_address: {
first_name: '<string>',
last_name: '<string>',
address: '<string>',
address_2: '<string>',
city: '<string>',
state: '<string>',
zip: '<string>',
phone: '<string>',
country_code: '<string>'
}
})
};
fetch('https://app.agscard.com/api/partner/v1/orders', 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://app.agscard.com/api/partner/v1/orders",
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([
'payment_plan_id' => 123,
'shipping_method_id' => 123,
'items' => [
[
'card_product_id' => 123,
'quantity' => 50,
'declared_value_per_unit' => 1
]
],
'upcharges' => [
'<string>'
],
'shipping_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'address' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'phone' => '<string>',
'country_code' => '<string>'
],
'billing_address' => [
'first_name' => '<string>',
'last_name' => '<string>',
'address' => '<string>',
'address_2' => '<string>',
'city' => '<string>',
'state' => '<string>',
'zip' => '<string>',
'phone' => '<string>',
'country_code' => '<string>'
]
]),
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://app.agscard.com/api/partner/v1/orders"
payload := strings.NewReader("{\n \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\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://app.agscard.com/api/partner/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.agscard.com/api/partner/v1/orders")
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 \"payment_plan_id\": 123,\n \"shipping_method_id\": 123,\n \"items\": [\n {\n \"card_product_id\": 123,\n \"quantity\": 50,\n \"declared_value_per_unit\": 1\n }\n ],\n \"upcharges\": [\n \"<string>\"\n ],\n \"shipping_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n },\n \"billing_address\": {\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address\": \"<string>\",\n \"address_2\": \"<string>\",\n \"city\": \"<string>\",\n \"state\": \"<string>\",\n \"zip\": \"<string>\",\n \"phone\": \"<string>\",\n \"country_code\": \"<string>\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"order_number": "<string>",
"status": "<string>",
"payment_status": "<string>",
"payment_url": "<string>",
"payment_plan_id": 123,
"price_per_card": 123,
"turnaround": "<string>",
"shipping_method": {
"id": 123,
"code": "<string>",
"name": "<string>"
},
"number_of_cards": 123,
"upcharges": [
{
"code": "<string>",
"amount": 123
}
],
"service_fee": 123,
"shipping_fee": 123,
"upcharges_fee": 123,
"discounted_amount": 123,
"grand_total": 123,
"created_at": "<string>",
"items": [
{
"id": 123,
"card_product_id": 123,
"card_name": "<string>",
"declared_value": 123
}
]
}
}{
"data": {
"id": 123,
"order_number": "<string>",
"status": "<string>",
"payment_status": "<string>",
"payment_url": "<string>",
"payment_plan_id": 123,
"price_per_card": 123,
"turnaround": "<string>",
"shipping_method": {
"id": 123,
"code": "<string>",
"name": "<string>"
},
"number_of_cards": 123,
"upcharges": [
{
"code": "<string>",
"amount": 123
}
],
"service_fee": 123,
"shipping_fee": 123,
"upcharges_fee": 123,
"discounted_amount": 123,
"grand_total": 123,
"created_at": "<string>",
"items": [
{
"id": 123,
"card_product_id": 123,
"card_name": "<string>",
"declared_value": 123
}
]
}
}{
"error": {
"code": "unauthenticated",
"message": "<string>"
}
}{
"error": {
"code": "idempotency_key_in_use",
"message": "<string>"
}
}{
"error": {
"code": "validation_failed",
"message": "<string>",
"errors": {}
}
}Authorizations
Body
application/json
A partner order uses flat IDs and inline addresses. Orders shipped to the customer need a shipping address; the billing address defaults to it.