Dashboard ↗

The server API uses resource objects to represent the different types of data that ProcessOut manages for you (for example, Invoice, Customer and Transaction). Browse the Resource types section of the sidebar to learn more about the structure of these objects.

There are several types of resources that you create explicitly when you need them. For example, you must create an Invoice before you can accept a payment and you can create a Customer to store payment details for a user. The create() function for these types lets you pass a parameter object with details of the data you want to store. The code sample shows how to create an Invoice with values for the customer_id, name, amount
and other fields.

curl -X POST https://api.processout.com/invoices \
    -u test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x:key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB \
    -d customer_id="cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc" \
    -d name="Amazing item" \
    -d statement_descriptor="amazing item" \
    -d amount="4.99" \
    -d currency="AUD" \
    -d order_id="000001"
var ProcessOut = require("processout");
var client = new ProcessOut(
    "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
    "key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB");

client.newInvoice().create({
    customer_id:          "cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc",
    name:                 "Amazing item",
    statement_descriptor: "amazing item",
    amount:               "4.99",
    currency:              "AUD"
}).then(function(invoice) {
    //

}, function(err) {
    // An error occured

});
import processout
client = processout.ProcessOut(
    "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x", 
    "key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB")

invoice = client.new_invoice().create({
    "customer_id":          "cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc",
    "name":                 "Amazing item",
    "statement_descriptor": "amazing item",
    "amount":               "4.99",
    "currency":              "AUD"
})
require "processout"
client = ProcessOut::Client.new(
    "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x", 
    "key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB")

invoice = client.invoice.create(
    customer_id:          "cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc",
    name:                 "Amazing item",
    statement_descriptor: "amazing item",
    amount:               "4.99",
    currency:              "AUD"
)
<?php
$client = new \ProcessOut\ProcessOut(
    "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x", 
    "key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB");

$invoice = $client->newInvoice()->create(array(
    "customer_id"          => "cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc",
    "name"                 => "Amazing item",
    "statement_descriptor" => "amazing item",
    "amount"               => "4.99",
    "currency"             => "AUD"
));
import "github.com/processout/processout-go"

var client = processout.New(
    "test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x", 
    "key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB",
)

iv, err := client.NewInvoice().Create(processout.InvoiceCreateParameters{
    Invoice: &processout.Invoice{
        CustomerID:          processout.String("cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc"),
        Name:                processout.String("Amazing item"),
        StatementDescriptor: processout.String("amazing item"),
        Amount:              processout.String("4.99"),
        Currency:            processout.String("AUD"),
    },
})

The response returned by create() is the new Invoice containing your specified data among many other fields. One of the most important fields is id, which contains a unique ID string for the object. You will use the id value extensively as a way to fetch objects and refer to them in the fields of other objects.

{
    "invoice": {
        "id": "iv_0kJ1i4d06uViosJjCKpUHzKeauffMom4",
        "project_id": "proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x",
        "subscription_id": null,
        "customer_id": "cust_CgdhFgj5QEv5I8dx6tHxVVrgxBDDzAgc",
        "token_id": null,
        "details": null,
        "transaction_id": "tr_qQI20QnTYPXK1MALJNfkOCjK8nycUObl",
        "name": "Amazing item",
      	"order_id" : "000001",
        "amount": "4.99",
        "currency": "AUD",
        "metadata": {},
        "gateway_data": {},
        "exemption_reason_3ds2": null,
        "challenge_indicator": null,
        .
        .
        .
    },
    "success": true
}