Basic Customer - email only

This guide walks through the basic setup of a customer.

Create a Customer

POSThttps://testapi.payarc.net/v1/customers

For this guide, we will create a basic customer profile containing only an email, [email protected].

import http.client

conn = http.client.HTTPSConnection("https")
payload = 'email=customer%40xyz.com'
headers = {
  'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}',
  'Accept': 'application/json',
  'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "//testapi.payarc.net/v1/customers", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var qs = require('querystring');

var options = {
  'method': 'POST',
  'hostname': 'https',
  'path': '//testapi.payarc.net/v1/customers',
  'headers': {
    'Authorization': '{{bearer_token}}',
    'Accept': 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  '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 = qs.stringify({
  'email': '[email protected]'
});

req.write(postData);

req.end();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://testapi.payarc.net/v1/customers");
request.Headers.Add("Authorization", "{{bearer_token}}");
request.Headers.Add("Accept", "application/json");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("email", "[email protected]"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

The response will return a new Customer object. For the next steps, you will need the newly generated customer ID KPxMADVnxMV4nNjp:

{
  "data": {
    "object": "customer",
    "id": "KPxMADVnxMV4nNjp",
    "name": null,
    "real_id": 110,
    "email": "[email protected]",
    "description": null,
    "payment_overdue": null,
    "send_email_address": null,
    "cc_email_address": null,
    "source_id": null,
    "address_1": null,
    "address_2": null,
    "city": null,
    "state": null,
    "zip": null,
    "phone": null,
    "country": null,
    "created_at": "2018-11-27 07:36:58",
    "updated_at": "2018-11-27 07:36:58",
    "readable_created_at": "1 second ago",
    "readable_updated_at": "1 second ago",
    "invoice_prefix": "52KZ",
    "card": {
      "data": []
    },
    "charge": {
      "data": []
    }
  },
  "meta": {
    "include": [
      "card",
      "charge",
      "subscription",
      "invoice"
    ],
    "custom": []
  }
}

You now have a customer record.